mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
net/tcp: fix flush() waiting forever if socket is reset with pending write data
This commit is contained in:
parent
2766993099
commit
e6f4db507d
@ -515,7 +515,7 @@ impl<'d> TcpIo<'d> {
|
|||||||
async fn flush(&mut self) -> Result<(), Error> {
|
async fn flush(&mut self) -> Result<(), Error> {
|
||||||
poll_fn(move |cx| {
|
poll_fn(move |cx| {
|
||||||
self.with_mut(|s, _| {
|
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!(
|
let fin_pending = matches!(
|
||||||
s.state(),
|
s.state(),
|
||||||
tcp::State::FinWait1 | tcp::State::Closing | tcp::State::LastAck
|
tcp::State::FinWait1 | tcp::State::Closing | tcp::State::LastAck
|
||||||
|
Loading…
Reference in New Issue
Block a user