Skip to content

Instantly share code, notes, and snippets.

@jzawodn
Created April 23, 2012 16:54
Show Gist options
  • Save jzawodn/2472265 to your computer and use it in GitHub Desktop.
Save jzawodn/2472265 to your computer and use it in GitHub Desktop.
--- searchd.cpp.orig 2012-04-16 15:23:46.000000000 -0700
+++ searchd.cpp 2012-04-18 17:05:29.000000000 -0700
@@ -1298,6 +1298,10 @@
#endif
const int iShutWaitPeriod = 3000000;
+
+ ARRAY_FOREACH ( i, g_dListeners )
+ if ( g_dListeners[i].m_iSock>=0 )
+ sphSockClose ( g_dListeners[i].m_iSock );
if ( g_eWorkers==MPM_THREADS )
{
@@ -1395,9 +1399,13 @@
sphShutdownWordforms ();
}
- ARRAY_FOREACH ( i, g_dListeners )
- if ( g_dListeners[i].m_iSock>=0 )
- sphSockClose ( g_dListeners[i].m_iSock );
+ // remove pid
+ if ( g_bHeadDaemon && g_sPidFile )
+ {
+ ::close ( g_iPidFD );
+ ::unlink ( g_sPidFile );
+ sync();
+ }
#if USE_WINDOWS
CloseHandle ( g_hPipe );
@@ -1411,13 +1419,6 @@
}
#endif
- // remove pid
- if ( g_bHeadDaemon && g_sPidFile )
- {
- ::close ( g_iPidFD );
- ::unlink ( g_sPidFile );
- }
-
if ( g_bHeadDaemon )
sphInfo ( "shutdown complete" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment