Improved ping thread stopping

This commit is contained in:
Michiel Broek 2004-08-14 12:28:15 +00:00
parent b99eb9aa26
commit ec76c05fa2

View File

@ -40,7 +40,7 @@
* Global variables * Global variables
*/ */
extern struct taskrec TCFG; /* Task config record */ extern struct taskrec TCFG; /* Task config record */
int ping_isocket; /* Ping socket */ int ping_isocket = -1; /* Ping socket */
int icmp_errs = 0; /* ICMP error counter */ int icmp_errs = 0; /* ICMP error counter */
extern int internet; /* Internet is down */ extern int internet; /* Internet is down */
extern int rescan; /* Master rescan flag */ extern int rescan; /* Master rescan flag */
@ -456,6 +456,12 @@ void *ping_thread(void)
} }
} }
Syslog('p', "Ping thread closing socket %d", ping_isocket);
if ((rc = close(ping_isocket))) {
WriteError("$ping thread error socket close");
}
ping_isocket = -1;
ping_run = FALSE; ping_run = FALSE;
Syslog('+', "Ping thread stopped"); Syslog('+', "Ping thread stopped");
pthread_exit(NULL); pthread_exit(NULL);