main: change socket alive flag to boolean

This commit is contained in:
topquark12 2021-01-26 17:31:09 +08:00
parent f5ce788eb6
commit 4f957e1bd1
1 changed files with 3 additions and 3 deletions

View File

@ -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();
}
}