aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/ficsmain.c
diff options
context:
space:
mode:
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;
}
}