--------------------- PatchSet 10584 Date: 2008/06/02 13:18:23 Author: serassio Branch: nt Tag: (none) Log: Always shutdown Winsocket at program termination Members: helpers/basic_auth/squid_radius_auth/squid_rad_auth.c:1.1.2.8->1.1.2.9 src/dnsserver.c:1.6.26.1->1.6.26.2 src/pinger.c:1.6.8.6->1.6.8.7 tools/squidclient.c:1.2.4.6->1.2.4.7 Index: squid/helpers/basic_auth/squid_radius_auth/squid_rad_auth.c =================================================================== RCS file: /cvsroot/squid-sf//squid/helpers/basic_auth/squid_radius_auth/squid_rad_auth.c,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -r1.1.2.8 -r1.1.2.9 --- squid/helpers/basic_auth/squid_radius_auth/squid_rad_auth.c 27 Apr 2008 09:16:27 -0000 1.1.2.8 +++ squid/helpers/basic_auth/squid_radius_auth/squid_rad_auth.c 2 Jun 2008 13:18:23 -0000 1.1.2.9 @@ -129,6 +129,15 @@ char *progname = "squid_rad_auth"; int debug_flag = 0; +#ifdef _SQUID_MSWIN_ +void +Win32SockCleanup(void) +{ + WSACleanup(); + return; +} +#endif /* ifdef _SQUID_MSWIN_ */ + /* * Diff two timeval, b - a */ @@ -505,6 +514,7 @@ { WSADATA wsaData; WSAStartup(2, &wsaData); + atexit(Win32SockCleanup); } #endif /* Index: squid/src/dnsserver.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/dnsserver.c,v retrieving revision 1.6.26.1 retrieving revision 1.6.26.2 diff -u -r1.6.26.1 -r1.6.26.2 --- squid/src/dnsserver.c 16 May 2006 21:06:03 -0000 1.6.26.1 +++ squid/src/dnsserver.c 2 Jun 2008 13:18:23 -0000 1.6.26.2 @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.c,v 1.6.26.1 2006/05/16 21:06:03 serassio Exp $ + * $Id: dnsserver.c,v 1.6.26.2 2008/06/02 13:18:23 serassio Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -346,8 +346,12 @@ #endif for (;;) { memset(request, '\0', REQ_SZ); - if (fgets(request, REQ_SZ, stdin) == NULL) + if (fgets(request, REQ_SZ, stdin) == NULL) { +#ifdef _SQUID_MSWIN_ + WSACleanup(); +#endif exit(1); + } t = strrchr(request, '\n'); if (t == NULL) /* Ignore if no newline */ continue; Index: squid/src/pinger.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/pinger.c,v retrieving revision 1.6.8.6 retrieving revision 1.6.8.7 diff -u -r1.6.8.6 -r1.6.8.7 --- squid/src/pinger.c 2 Jun 2008 12:10:43 -0000 1.6.8.6 +++ squid/src/pinger.c 2 Jun 2008 13:18:23 -0000 1.6.8.7 @@ -1,6 +1,6 @@ /* - * $Id: pinger.c,v 1.6.8.6 2008/06/02 12:10:43 serassio Exp $ + * $Id: pinger.c,v 1.6.8.7 2008/06/02 13:18:23 serassio Exp $ * * DEBUG: section 42 ICMP Pinger program * AUTHOR: Duane Wessels @@ -190,6 +190,15 @@ static void pingerOpen(void); static void pingerClose(void); +#ifdef _SQUID_MSWIN_ +void +Win32SockCleanup(void) +{ + WSACleanup(); + return; +} +#endif /* ifdef _SQUID_MSWIN_ */ + void pingerOpen(void) { @@ -202,6 +211,7 @@ struct sockaddr_in PS; WSAStartup(2, &wsaData); + atexit(Win32SockCleanup); getCurrentTime(); _db_init(NULL, "ALL,1"); Index: squid/tools/squidclient.c =================================================================== RCS file: /cvsroot/squid-sf//squid/tools/squidclient.c,v retrieving revision 1.2.4.6 retrieving revision 1.2.4.7 diff -u -r1.2.4.6 -r1.2.4.7 --- squid/tools/squidclient.c 15 Dec 2007 20:05:32 -0000 1.2.4.6 +++ squid/tools/squidclient.c 2 Jun 2008 13:18:24 -0000 1.2.4.7 @@ -1,6 +1,6 @@ /* - * $Id: squidclient.c,v 1.2.4.6 2007/12/15 20:05:32 serassio Exp $ + * $Id: squidclient.c,v 1.2.4.7 2008/06/02 13:18:24 serassio Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived @@ -128,6 +128,15 @@ int total_bytes = 0; int io_timeout = 120; +#ifdef _SQUID_MSWIN_ +void +Win32SockCleanup(void) +{ + WSACleanup(); + return; +} +#endif /* ifdef _SQUID_MSWIN_ */ + static void usage(const char *progname) { @@ -295,6 +304,7 @@ { WSADATA wsaData; WSAStartup(2, &wsaData); + atexit(Win32SockCleanup); } #endif /* Build the HTTP request */