--------------------- PatchSet 5401 Date: 2002/10/20 09:17:30 Author: serassio Branch: nt-2_5 Tag: (none) Log: Made the Squid <==> Service Control Manager synchronization more detailed Members: src/main.c:1.28.6.1.4.12->1.28.6.1.4.13 src/win32.c:1.5.14.10->1.5.14.11 Index: squid/src/main.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/main.c,v retrieving revision 1.28.6.1.4.12 retrieving revision 1.28.6.1.4.13 diff -u -r1.28.6.1.4.12 -r1.28.6.1.4.13 --- squid/src/main.c 14 Oct 2002 17:55:09 -0000 1.28.6.1.4.12 +++ squid/src/main.c 20 Oct 2002 09:17:30 -0000 1.28.6.1.4.13 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.28.6.1.4.12 2002/10/14 17:55:09 serassio Exp $ + * $Id: main.c,v 1.28.6.1.4.13 2002/10/20 09:17:30 serassio Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -42,7 +42,7 @@ static int opt_remove_service = FALSE; static int opt_signal_service = FALSE; static int opt_command_line = FALSE; -extern void WIN32_svcstatusupdate(DWORD); +extern void WIN32_svcstatusupdate(DWORD, DWORD); void WINAPI WIN32_svcHandler(DWORD); #endif @@ -736,7 +736,7 @@ failure_notify = fatal_dump; #if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) - WIN32_svcstatusupdate(SERVICE_START_PENDING); + WIN32_svcstatusupdate(SERVICE_START_PENDING, 10000); #endif mainParseOptions(argc, argv); @@ -833,12 +833,12 @@ fd_open(2, FD_LOG, "stderr"); } #if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) - WIN32_svcstatusupdate(SERVICE_START_PENDING); + WIN32_svcstatusupdate(SERVICE_START_PENDING, 10000); #endif mainInitialize(); #if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) - WIN32_svcstatusupdate(SERVICE_RUNNING); + WIN32_svcstatusupdate(SERVICE_RUNNING, 0); #endif /* main loop */ @@ -862,10 +862,10 @@ (int) wait); do_shutdown = 0; shutting_down = 1; - serverConnectionsClose(); #if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) - WIN32_svcstatusupdate(SERVICE_STOP_PENDING); + WIN32_svcstatusupdate(SERVICE_STOP_PENDING, (wait + 1) * 1000); #endif + serverConnectionsClose(); #if USE_DNSSERVERS dnsShutdown(); #else @@ -1111,6 +1111,9 @@ static void SquidShutdown(void *unused) { +#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) + WIN32_svcstatusupdate(SERVICE_STOP_PENDING, 10000); +#endif debug(1, 1) ("Shutting down...\n"); if (Config.pidFilename && strcmp(Config.pidFilename, "none")) { enter_suid(); @@ -1133,6 +1136,9 @@ #if USE_UNLINKD unlinkdClose(); #endif +#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) + WIN32_svcstatusupdate(SERVICE_STOP_PENDING, 10000); +#endif storeDirSync(); /* Flush pending object writes/unlinks */ storeDirWriteCleanLogs(0); PrintRusage(); Index: squid/src/win32.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/win32.c,v retrieving revision 1.5.14.10 retrieving revision 1.5.14.11 diff -u -r1.5.14.10 -r1.5.14.11 --- squid/src/win32.c 21 Sep 2002 16:51:19 -0000 1.5.14.10 +++ squid/src/win32.c 20 Oct 2002 09:17:30 -0000 1.5.14.11 @@ -51,7 +51,7 @@ #endif static unsigned int GetOSVersion(); -void WIN32_svcstatusupdate(DWORD); +void WIN32_svcstatusupdate(DWORD, DWORD); void WINAPI WIN32_svcHandler(DWORD); static int WIN32_StoreKey(const char *, DWORD, unsigned char *, int); static int WIN32_create_key(void); @@ -427,10 +427,11 @@ #ifdef USE_WIN32_SERVICE void -WIN32_svcstatusupdate(DWORD svcstate) +WIN32_svcstatusupdate(DWORD svcstate, DWORD WaitHint) { if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) { svcStatus.dwCheckPoint++; + svcStatus.dwWaitHint = WaitHint; svcStatus.dwCurrentState = svcstate; SetServiceStatus(svcHandle, &svcStatus); }