From 6bd82d1fb4a45444afb310053936f5e68cde885f Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Tue, 29 Jun 2010 23:00:24 -0400 Subject: [PATCH] Add fsctl shutdown_check to see if we're currently shutting down --- src/include/switch_types.h | 3 ++- src/mod/applications/mod_commands/mod_commands.c | 3 +++ src/switch_core.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index e65b3b78ce..d18f6ecb93 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1539,7 +1539,8 @@ typedef enum { SCSC_SAVE_HISTORY, SCSC_CRASH, SCSC_MIN_IDLE_CPU, - SCSC_VERBOSE_EVENTS + SCSC_VERBOSE_EVENTS, + SCSC_SHUTDOWN_CHECK } switch_session_ctl_t; typedef enum { diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 8c83dfc86f..9e0066191c 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1563,6 +1563,9 @@ SWITCH_STANDARD_API(ctl_function) } else if (!strcasecmp(argv[0], "save_history")) { switch_core_session_ctl(SCSC_SAVE_HISTORY, NULL); stream->write_function(stream, "+OK\n"); + } else if (!strcasecmp(argv[0], "shutdown_check")) { + switch_core_session_ctl(SCSC_SHUTDOWN_CHECK, &arg); + stream->write_function(stream, arg ? "true" : "false"); } else if (!strcasecmp(argv[0], "shutdown")) { switch_session_ctl_t command = SCSC_SHUTDOWN; int x = 0; diff --git a/src/switch_core.c b/src/switch_core.c index 37dabbc6e9..d48cd46dfc 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1772,6 +1772,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void * } } break; + case SCSC_SHUTDOWN_CHECK: + newintval = !!switch_test_flag((&runtime), SCF_SHUTDOWN_REQUESTED); + break; case SCSC_SHUTDOWN: #ifdef _MSC_VER