Browse Source

Add 15 seconds hard cap on shutdown wait.

pull/97/head
FireMartZ 6 years ago
parent
commit
181be5b3da
  1. 6
      src/init.cpp

6
src/init.cpp

@ -294,6 +294,8 @@ void HandleSIGHUP(int)
#ifdef WIN32
BOOL CtrlHandler( DWORD fdwCtrlType )
{
int64_t nMaxWait = 15; // seconds
int64_t nStart = GetTime();
switch( fdwCtrlType )
{
case CTRL_C_EVENT:
@ -302,8 +304,8 @@ BOOL CtrlHandler( DWORD fdwCtrlType )
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT:
fRequestShutdown = true;
std::cout << _("Shutting down node. This may take a while, be patient!") << std::endl;
while (!fShutdownCompleted)
std::cout << _("Shutting down node. This may take a while, be patient!") << std::endl;
while (!fShutdownCompleted && (GetTime() - nStart < nMaxWait))
{
MilliSleep(100);
}

Loading…
Cancel
Save