diff --git a/embassy-net/src/tcp_socket.rs b/embassy-net/src/tcp_socket.rs index def4c8176..25c8af459 100644 --- a/embassy-net/src/tcp_socket.rs +++ b/embassy-net/src/tcp_socket.rs @@ -151,6 +151,11 @@ impl<'a> AsyncBufRead for TcpSocket<'a> { } fn consume(self: Pin<&mut Self>, amt: usize) { + if amt == 0 { + // smoltcp's recv returns Finished if we're at EOF, + // even if we're "reading" 0 bytes. + return; + } self.with(|s| s.recv(|_| (amt, ()))).unwrap() } }