From 8ab161227432ce3aa713a00b80695c8d73e7c823 Mon Sep 17 00:00:00 2001 From: Mathias Date: Sat, 3 Feb 2024 20:42:14 +0100 Subject: [PATCH] Correctly handle closing a dropped socket in FinWait1 state --- src/asynch/runner.rs | 1 + src/asynch/ublox_stack/tcp.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/asynch/runner.rs b/src/asynch/runner.rs index 260b190..bab1368 100644 --- a/src/asynch/runner.rs +++ b/src/asynch/runner.rs @@ -252,6 +252,7 @@ impl< } DisconnectReason::SecurityProblems => { error!("Wifi Security Problems"); + con.wifi_state = WiFiState::NotConnected; } _ => { con.wifi_state = WiFiState::NotConnected; diff --git a/src/asynch/ublox_stack/tcp.rs b/src/asynch/ublox_stack/tcp.rs index 33a16f8..aef9f89 100644 --- a/src/asynch/ublox_stack/tcp.rs +++ b/src/asynch/ublox_stack/tcp.rs @@ -347,7 +347,10 @@ impl<'a> TcpSocket<'a> { impl<'a> Drop for TcpSocket<'a> { fn drop(&mut self) { - if matches!(self.state(), TcpState::Listen | TcpState::Established) { + if matches!( + self.state(), + TcpState::Listen | TcpState::Established | TcpState::FinWait1 + ) { if let Some(peer_handle) = self.io.with(|s| s.peer_handle) { self.io .stack