A lot of updates

This commit is contained in:
WolverinDEV
2019-11-22 20:51:00 +01:00
parent 44fe958f31
commit 0d3d3cfc53
31 changed files with 700 additions and 426 deletions
+15 -10
View File
@@ -15,22 +15,27 @@ bool shuttingDown = false;
void ts::server::shutdownInstance(const std::string& message) {
if(shuttingDown) return;
shuttingDown = true;
threads::Thread(THREAD_EXECUTE_LATER, [](){
auto hangup_controller = std::thread([]{
threads::self::sleep_for(chrono::seconds(30));
logCritical("Could not shutdown server within 30 seconds! (Hangup!)");
logCritical("Killing server!");
logCriticalFmt(true, 0, "Could not shutdown server within 30 seconds! (Hangup!)");
logCriticalFmt(true, 0, "Killing server!");
threads::Thread(THREAD_EXECUTE_LATER, [](){
auto force_kill = std::thread([]{
threads::self::sleep_for(chrono::seconds(5));
logCritical("Failed to exit normally!");
logCritical("executing raise(SIGKILL);");
logCriticalFmt(true, 0, "Failed to exit normally!");
logCriticalFmt(true, 0, "executing raise(SIGKILL);");
raise(SIGKILL);
}).name("Stop exit controller").execute().detach();
});
threads::name(force_kill, "force stopper");
force_kill.detach();
exit(2);
}).name("Stop controller").execute().detach();
});
threads::name(hangup_controller, "stop controller");
hangup_controller.detach();
logMessage("Stopping all server instances!");
logMessage(LOG_GENERAL, "Stopping all server instances!");
if(serverInstance && serverInstance->getVoiceServerManager())
serverInstance->getVoiceServerManager()->shutdownAll(message);