mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
Merge pull request #3198 from sammhicks/main
net/tcp: fix flush() waiting forever if socket is reset with pending write data
This commit is contained in:
commit
7a26e117cc
@ -515,7 +515,7 @@ impl<'d> TcpIo<'d> {
|
||||
async fn flush(&mut self) -> Result<(), Error> {
|
||||
poll_fn(move |cx| {
|
||||
self.with_mut(|s, _| {
|
||||
let data_pending = s.send_queue() > 0;
|
||||
let data_pending = (s.send_queue() > 0) && s.state() != tcp::State::Closed;
|
||||
let fin_pending = matches!(
|
||||
s.state(),
|
||||
tcp::State::FinWait1 | tcp::State::Closing | tcp::State::LastAck
|
||||
|
Loading…
Reference in New Issue
Block a user