Skip to content

Commit 149caba

Browse files
author
Johannes Draaijer
committed
Detect when we're no longer capable of sending/receiving
1 parent 4b89fd0 commit 149caba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/rtic-echo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ mod app {
3232
use smoltcp::{
3333
iface::{self, Interface, SocketHandle},
3434
socket::TcpSocket,
35-
socket::TcpSocketBuffer,
35+
socket::{TcpSocketBuffer, TcpState},
3636
wire::EthernetAddress,
3737
};
3838

@@ -164,7 +164,7 @@ mod app {
164164
}
165165
}
166166

167-
if !socket.is_listening() && !socket.is_open() {
167+
if !socket.is_listening() && !socket.is_open() || socket.state() == TcpState::CloseWait {
168168
socket.abort();
169169
socket.listen(crate::ADDRESS).ok();
170170
defmt::warn!("Disconnected... Reopening listening socket.");

0 commit comments

Comments
 (0)