From: serassio <> Date: Sat, 2 Sep 2006 21:24:08 +0000 (+0000) Subject: Windows port: Added MinGW support to helper.cc X-Git-Tag: SQUID_3_0_PRE5~141 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d5d52617b430fa80b8542838fb3d077ad342c66;p=thirdparty%2Fsquid.git Windows port: Added MinGW support to helper.cc --- diff --git a/src/helper.cc b/src/helper.cc index 352c422b82..622089f514 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -1,6 +1,6 @@ /* - * $Id: helper.cc,v 1.75 2006/08/21 00:50:41 robertc Exp $ + * $Id: helper.cc,v 1.76 2006/09/02 15:24:08 serassio Exp $ * * DEBUG: section 84 Helper process maintenance * AUTHOR: Harvest Derived? @@ -615,6 +615,12 @@ void helperShutdown(helper * hlp) { dlink_node *link = hlp->servers.head; +#ifdef _SQUID_MSWIN_ + + HANDLE hIpc; + pid_t pid; + int no; +#endif while (link) { helper_server *srv; @@ -645,12 +651,35 @@ helperShutdown(helper * hlp) } srv->flags.closing = 1; +#ifdef _SQUID_MSWIN_ + + hIpc = srv->hIpc; + pid = srv->pid; + no = srv->index + 1; + shutdown(srv->wfd, SD_BOTH); +#endif + debug(84, 3) ("helperShutdown: %s #%d shutting down.\n", hlp->id_name, srv->index + 1); /* the rest of the details is dealt with in the helperServerFree * close handler */ comm_close(srv->rfd); +#ifdef _SQUID_MSWIN_ + + if (hIpc) { + if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { + getCurrentTime(); + debug(84, 1) ("helperShutdown: WARNING: %s #%d (%s,%ld) " + "didn't exit in 5 seconds\n", + hlp->id_name, no, hlp->cmdline->key, (long int)pid); + } + + CloseHandle(hIpc); + } + +#endif + } } @@ -659,6 +688,12 @@ helperStatefulShutdown(statefulhelper * hlp) { dlink_node *link = hlp->servers.head; helper_stateful_server *srv; +#ifdef _SQUID_MSWIN_ + + HANDLE hIpc; + pid_t pid; + int no; +#endif while (link) { srv = (helper_stateful_server *)link->data; @@ -699,12 +734,35 @@ helperStatefulShutdown(statefulhelper * hlp) } srv->flags.closing = 1; +#ifdef _SQUID_MSWIN_ + + hIpc = srv->hIpc; + pid = srv->pid; + no = srv->index + 1; + shutdown(srv->wfd, SD_BOTH); +#endif + debug(84, 3) ("helperStatefulShutdown: %s #%d shutting down.\n", hlp->id_name, srv->index + 1); /* the rest of the details is dealt with in the helperStatefulServerFree * close handler */ comm_close(srv->rfd); +#ifdef _SQUID_MSWIN_ + + if (hIpc) { + if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { + getCurrentTime(); + debug(84, 1) ("helperShutdown: WARNING: %s #%d (%s,%ld) " + "didn't exit in 5 seconds\n", + hlp->id_name, no, hlp->cmdline->key, (long int)pid); + } + + CloseHandle(hIpc); + } + +#endif + } } diff --git a/src/helper.h b/src/helper.h index 0bdb5d9222..a4f6abb2c7 100644 --- a/src/helper.h +++ b/src/helper.h @@ -1,6 +1,6 @@ /* - * $Id: helper.h,v 1.4 2006/08/21 00:50:41 robertc Exp $ + * $Id: helper.h,v 1.5 2006/09/02 15:24:08 serassio Exp $ * * DEBUG: section 84 Helper process maintenance * AUTHOR: Harvest Derived? @@ -149,6 +149,10 @@ unsigned int shutdown: } stats; +#ifdef _SQUID_MSWIN_ + + HANDLE hIpc; +#endif }; class helper_stateful_request; @@ -202,6 +206,10 @@ unsigned int shutdown: stats; int deferred_requests; /* current number of deferred requests */ void *data; /* State data used by the calling routines */ +#ifdef _SQUID_MSWIN_ + + HANDLE hIpc; +#endif }; class helper_request