From 4f957e1bd17a8eab0025541855dd0aae4f4c9ee9 Mon Sep 17 00:00:00 2001 From: topquark12 Date: Tue, 26 Jan 2021 17:31:09 +0800 Subject: [PATCH] main: change socket alive flag to boolean --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2680068..5a12b00 100644 --- a/src/main.rs +++ b/src/main.rs @@ -459,16 +459,16 @@ fn main() -> ! { }); } else { // Should reset, close all TCP sockets. - let mut sockets_active = 0; + let mut any_socket_alive = false; server.for_each(|mut socket, _| { if socket.is_active() { socket.abort(); - sockets_active += 1; + any_socket_alive = true; } }); // Must let loop run one more cycle to poll server in order for RST to be sent, // this makes sure system does not reset right after socket.abort() is called. - if sockets_active == 0 { + if !any_socket_alive { SCB::sys_reset(); } }