Merge pull request #3141 from trepidacious/ready_ready_and_write_ready_fix

Update `ReadReady` and `WriteReady` implementations
This commit is contained in:
Dario Nieuwenhuis 2024-07-01 23:21:10 +00:00 committed by GitHub
commit 3d8cec3b47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -603,7 +603,7 @@ mod embedded_io_impls {
impl<'d> embedded_io_async::WriteReady for TcpSocket<'d> {
fn write_ready(&mut self) -> Result<bool, Self::Error> {
Ok(self.io.with(|s, _| s.may_send()))
Ok(self.io.with(|s, _| s.can_send()))
}
}
@ -619,7 +619,7 @@ mod embedded_io_impls {
impl<'d> embedded_io_async::ReadReady for TcpReader<'d> {
fn read_ready(&mut self) -> Result<bool, Self::Error> {
Ok(self.io.with(|s, _| s.can_recv()))
Ok(self.io.with(|s, _| s.can_recv() || !s.may_recv()))
}
}
@ -639,7 +639,7 @@ mod embedded_io_impls {
impl<'d> embedded_io_async::WriteReady for TcpWriter<'d> {
fn write_ready(&mut self) -> Result<bool, Self::Error> {
Ok(self.io.with(|s, _| s.may_send()))
Ok(self.io.with(|s, _| s.can_send()))
}
}
}