A lot of updates
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user