From ec76c05fa277be68b8e4904b21a6a4ad52b11f89 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 14 Aug 2004 12:28:15 +0000 Subject: [PATCH] Improved ping thread stopping --- mbtask/ping.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mbtask/ping.c b/mbtask/ping.c index d9f2e496..97483aaa 100644 --- a/mbtask/ping.c +++ b/mbtask/ping.c @@ -40,7 +40,7 @@ * Global variables */ 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 */ extern int internet; /* Internet is down */ 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; Syslog('+', "Ping thread stopped"); pthread_exit(NULL);