diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-13 00:04:18 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-13 00:04:18 +0100 |
commit | 14bdbdaa22b062a8a7301f78e36fc4940eef978a (patch) | |
tree | 95227484ef5e7b3502527df855b5ca557cf48e90 | |
parent | 4cd9543226d7e492b632ffc375d4b43ac46a168c (diff) |
main_event_loop: set and check 'sockfd'
-rw-r--r-- | FICS/ficsmain.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/FICS/ficsmain.c b/FICS/ficsmain.c index ddc8b70..1317955 100644 --- a/FICS/ficsmain.c +++ b/FICS/ficsmain.c @@ -101,14 +101,17 @@ PRIVATE void main_event_loop(void) { char command_string[MAX_STRING_LENGTH]; - int sockfd; + int sockfd = -1; while (1) { ngc2(command_string, HEARTBEATTIME); - if (process_heartbeat(&sockfd) == COM_LOGOUT) { + + if (process_heartbeat(&sockfd) == COM_LOGOUT && sockfd != -1) { process_disconnection(sockfd); net_close_connection(sockfd); } + + sockfd = -1; } } |