diff options
| author | trepidacious <[email protected]> | 2024-07-01 20:59:27 +0100 |
|---|---|---|
| committer | trepidacious <[email protected]> | 2024-07-01 20:59:27 +0100 |
| commit | abe7f9921e4b04b8341396c2681730ed3aa59d90 (patch) | |
| tree | 08e54740ea7505901fe748dd2a00a2ff4064d2ab /embassy-net/src | |
| parent | 92eb6011d60b95a7c249212fef874ff952f98f78 (diff) | |
Update `ReadReady` and `WriteReady` implementations
Update `ReadReady` for `TcpReader` to match implementation for `TcpSocket`
Update `WriteReady` implementations to use `can_recv()` rather than `may_recv()`, since this will check that the transmit buffer is not full.
Diffstat (limited to 'embassy-net/src')
| -rw-r--r-- | embassy-net/src/tcp.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs index 4d6dc92de..74eff9dae 100644 --- a/embassy-net/src/tcp.rs +++ b/embassy-net/src/tcp.rs | |||
| @@ -603,7 +603,7 @@ mod embedded_io_impls { | |||
| 603 | 603 | ||
| 604 | impl<'d> embedded_io_async::WriteReady for TcpSocket<'d> { | 604 | impl<'d> embedded_io_async::WriteReady for TcpSocket<'d> { |
| 605 | fn write_ready(&mut self) -> Result<bool, Self::Error> { | 605 | fn write_ready(&mut self) -> Result<bool, Self::Error> { |
| 606 | Ok(self.io.with(|s, _| s.may_send())) | 606 | Ok(self.io.with(|s, _| s.can_send())) |
| 607 | } | 607 | } |
| 608 | } | 608 | } |
| 609 | 609 | ||
| @@ -619,7 +619,7 @@ mod embedded_io_impls { | |||
| 619 | 619 | ||
| 620 | impl<'d> embedded_io_async::ReadReady for TcpReader<'d> { | 620 | impl<'d> embedded_io_async::ReadReady for TcpReader<'d> { |
| 621 | fn read_ready(&mut self) -> Result<bool, Self::Error> { | 621 | fn read_ready(&mut self) -> Result<bool, Self::Error> { |
| 622 | Ok(self.io.with(|s, _| s.can_recv())) | 622 | Ok(self.io.with(|s, _| s.can_recv() || !s.may_recv())) |
| 623 | } | 623 | } |
| 624 | } | 624 | } |
| 625 | 625 | ||
| @@ -639,7 +639,7 @@ mod embedded_io_impls { | |||
| 639 | 639 | ||
| 640 | impl<'d> embedded_io_async::WriteReady for TcpWriter<'d> { | 640 | impl<'d> embedded_io_async::WriteReady for TcpWriter<'d> { |
| 641 | fn write_ready(&mut self) -> Result<bool, Self::Error> { | 641 | fn write_ready(&mut self) -> Result<bool, Self::Error> { |
| 642 | Ok(self.io.with(|s, _| s.may_send())) | 642 | Ok(self.io.with(|s, _| s.can_send())) |
| 643 | } | 643 | } |
| 644 | } | 644 | } |
| 645 | } | 645 | } |
