mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
make windows restart while it's blocking on the console FSCORE-435
Should work in every case with 1 exception if you have started to type a command on the real console and never hit enter then do a *restart* not a shutdown, you will have to complete the command. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15167 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -1593,11 +1593,36 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_
|
||||
}
|
||||
break;
|
||||
case SCSC_SHUTDOWN:
|
||||
|
||||
#ifdef _MSC_VER
|
||||
{
|
||||
HANDLE shutdown_event;
|
||||
char path[512];
|
||||
/* for windows we need the event to signal for shutting down a background FreeSWITCH */
|
||||
snprintf(path, sizeof(path), "Global\\Freeswitch.%d", getpid());
|
||||
|
||||
/* open the event so we can signal it */
|
||||
shutdown_event = OpenEvent(EVENT_MODIFY_STATE, FALSE, path);
|
||||
|
||||
|
||||
if (shutdown_event) {
|
||||
/* signal the event to shutdown */
|
||||
SetEvent(shutdown_event);
|
||||
/* cleanup */
|
||||
CloseHandle(shutdown_event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (*val) {
|
||||
switch_set_flag((&runtime), SCF_RESTART);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Restarting\n");
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Shutting down\n");
|
||||
#ifdef _MSC_VER
|
||||
fclose(stdin);
|
||||
#endif
|
||||
}
|
||||
runtime.running = 0;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user