Build fix in tap, handling of Windows shutdown signals.
This commit is contained in:
parent
cd907a7662
commit
c247a3d991
2 changed files with 19 additions and 1 deletions
18
main.cpp
18
main.cpp
|
@ -107,6 +107,23 @@ static void sighandlerQuit(int sig)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
static BOOL WINAPI _handlerRoutine(DWORD dwCtrlType)
|
||||
{
|
||||
switch(dwCtrlType) {
|
||||
case CTRL_C_EVENT:
|
||||
case CTRL_BREAK_EVENT:
|
||||
case CTRL_CLOSE_EVENT:
|
||||
case CTRL_SHUTDOWN_EVENT:
|
||||
Node *n = node;
|
||||
if (n)
|
||||
n->terminate();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
#else
|
||||
|
@ -127,6 +144,7 @@ int main(int argc,char **argv)
|
|||
#ifdef __WINDOWS__
|
||||
WSADATA wsaData;
|
||||
WSAStartup(MAKEWORD(2,2),&wsaData);
|
||||
SetConsoleCtrlHandler(&_handlerRoutine,TRUE);
|
||||
#endif
|
||||
|
||||
_initLibCrypto();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue