diff --git a/src/init.cpp b/src/init.cpp index 508f41666..e878110e2 100644 --- a/src/init.cpp +++ b/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); }