aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/ficsmain.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-13 00:04:18 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-13 00:04:18 +0100
commit14bdbdaa22b062a8a7301f78e36fc4940eef978a (patch)
tree95227484ef5e7b3502527df855b5ca557cf48e90 /FICS/ficsmain.c
parent4cd9543226d7e492b632ffc375d4b43ac46a168c (diff)
main_event_loop: set and check 'sockfd'
Diffstat (limited to 'FICS/ficsmain.c')
-rw-r--r--FICS/ficsmain.c7
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;
}
}