aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-net/CHANGELOG.md4
-rw-r--r--embassy-net/src/tcp.rs7
2 files changed, 11 insertions, 0 deletions
diff --git a/embassy-net/CHANGELOG.md b/embassy-net/CHANGELOG.md
index 4030e050b..ada34cb75 100644
--- a/embassy-net/CHANGELOG.md
+++ b/embassy-net/CHANGELOG.md
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 7
8## Unreleased
9
10- Avoid never resolving `TcpIo::read` when the output buffer is empty.
11
8## 0.2.1 - 2023-10-31 12## 0.2.1 - 2023-10-31
9 13
10- Re-add impl_trait_projections 14- Re-add impl_trait_projections
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs
index b5615cb66..bcd5bb618 100644
--- a/embassy-net/src/tcp.rs
+++ b/embassy-net/src/tcp.rs
@@ -390,6 +390,13 @@ impl<'d> TcpIo<'d> {
390 // CAUTION: smoltcp semantics around EOF are different to what you'd expect 390 // CAUTION: smoltcp semantics around EOF are different to what you'd expect
391 // from posix-like IO, so we have to tweak things here. 391 // from posix-like IO, so we have to tweak things here.
392 self.with_mut(|s, _| match s.recv_slice(buf) { 392 self.with_mut(|s, _| match s.recv_slice(buf) {
393 // Reading into empty buffer
394 Ok(0) if buf.is_empty() => {
395 // embedded_io_async::Read's contract is to not block if buf is empty. While
396 // this function is not a direct implementor of the trait method, we still don't
397 // want our future to never resolve.
398 Poll::Ready(Ok(0))
399 }
393 // No data ready 400 // No data ready
394 Ok(0) => { 401 Ok(0) => {
395 s.register_recv_waker(cx.waker()); 402 s.register_recv_waker(cx.waker());