From 7bf2a6ca5de252b706ddfa1e43262d9781c54d7f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 5 Oct 2007 13:42:11 +0000 Subject: [PATCH] add max_sessions fsctl command git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5812 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_types.h | 3 ++- src/mod/applications/mod_commands/mod_commands.c | 6 ++++++ src/switch_core.c | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 2b3be5aaee..3adcb4886e 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1009,7 +1009,8 @@ typedef enum { SCSC_LOGLEVEL, SCSC_SPS, SCSC_LAST_SPS, - SCSC_RECLAIM + SCSC_RECLAIM, + SCSC_MAX_SESSIONS } switch_session_ctl_t; typedef struct apr_pool_t switch_memory_pool_t; diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 021e3f82f3..377beda9b6 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -121,6 +121,12 @@ SWITCH_STANDARD_API(ctl_function) switch_core_session_ctl(SCSC_SHUTDOWN, &arg); } else if (!strcasecmp(argv[0], "reclaim_mem")) { switch_core_session_ctl(SCSC_RECLAIM, &arg); + } else if (!strcasecmp(argv[0], "max_sessions")) { + if (argc > 1) { + arg = atoi(argv[1]); + } + switch_core_session_ctl(SCSC_MAX_SESSIONS, &arg); + stream->write_function(stream, "max sessions: %d\n", arg); } else if (!strcasecmp(argv[0], "loglevel")) { if (argc > 1) { if (*argv[1] > 47 && *argv[1] < 58) { diff --git a/src/switch_core.c b/src/switch_core.c index 0fcc499766..1e6f095757 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -657,6 +657,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_ } *val = runtime.hard_log_level; break; + case SCSC_MAX_SESSIONS: + *val = switch_core_session_limit(*val); + break; case SCSC_LAST_SPS: *val = runtime.sps_last; break;