MCPcopy Create free account
hub / github.com/dobin/RedEdr / StopWebServer

Function StopWebServer

RedEdr/webserver.cpp:366–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364
365
366void StopWebServer() {
367 // Signal stop
368 if (hStopEventWeb != NULL) {
369 SetEvent(hStopEventWeb);
370 }
371
372 svr.stop();
373
374 // Wait for thread to exit cleanly
375 if (webserver_thread != NULL) {
376 if (WaitForSingleObject(webserver_thread, 5000) == WAIT_TIMEOUT) {
377 LOG_A(LOG_WARNING, "WEB: Thread did not exit in time, force-terminating");
378 TerminateThread(webserver_thread, 1);
379 }
380 // handle ownership stays with the threads vector; do not close here
381 }
382
383 if (hStopEventWeb != NULL) {
384 CloseHandle(hStopEventWeb);
385 hStopEventWeb = NULL;
386 }
387}
388

Callers 1

ManagerShutdownFunction · 0.85

Calls 2

stopMethod · 0.80
LOG_AFunction · 0.70

Tested by

no test coverage detected