git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@149
1a98c847-1fd6-4fd8-948a-
caf3550aa51b
#include <net/if.h>
#include <ifaddrs.h>
#include <fcntl.h>
+#include <signal.h>
#endif
#ifdef BSD
#include <netinet/in.h>
-
//////////////////////////////////////////////////////////////////////////////
//
// Shutdown
}
}
+void HandleSIGTERM(int)
+{
+ fRequestShutdown = true;
+}
+
#ifndef __WXMSW__
umask(077);
#endif
+#ifndef __WXMSW__
+ // Clean shutdown on SIGTERM
+ struct sigaction sa;
+ sa.sa_handler = HandleSIGTERM;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction(SIGTERM, &sa, NULL);
+#endif
//
// Parameters
// Wait and allow messages to bunch up
vnThreadsRunning[2]--;
Sleep(100);
+ if (fRequestShutdown)
+ Shutdown(NULL);
vnThreadsRunning[2]++;
if (fShutdown)
return;
bool fPrintToConsole = false;
bool fPrintToDebugger = false;
char pszSetDataDir[MAX_PATH] = "";
+bool fRequestShutdown = false;
bool fShutdown = false;
bool fDaemon = false;
bool fCommandLine = false;
extern bool fPrintToConsole;
extern bool fPrintToDebugger;
extern char pszSetDataDir[MAX_PATH];
+extern bool fRequestShutdown;
extern bool fShutdown;
extern bool fDaemon;
extern bool fCommandLine;