fix startup race
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5502 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
fc1cd4e38b
commit
d04d8ffea1
|
@ -398,6 +398,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(const char *console, const char
|
|||
switch_uuid_t uuid;
|
||||
memset(&runtime, 0, sizeof(runtime));
|
||||
|
||||
runtime.no_new_sessions = 1;
|
||||
|
||||
/* INIT APR and Create the pool context */
|
||||
if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
|
||||
*err = "FATAL ERROR! Could not initilize APR\n";
|
||||
|
@ -577,6 +579,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(const char *console
|
|||
"\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\n\n", SWITCH_VERSION_FULL,
|
||||
runtime.crash_prot ? "Enabled" : "Disabled",
|
||||
switch_core_session_limit(0));
|
||||
|
||||
runtime.no_new_sessions = 0;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
|
|
@ -767,7 +767,10 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request(const switch
|
|||
switch_uuid_t uuid;
|
||||
uint32_t count = 0;
|
||||
|
||||
assert(endpoint_interface != NULL);
|
||||
if (!switch_core_ready() || endpoint_interface == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "The system cannot create any sessions at this time.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch_mutex_lock(session_manager.session_table_mutex);
|
||||
count = session_manager.session_count;
|
||||
|
@ -778,11 +781,6 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request(const switch
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!switch_core_ready()) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read my lips: no new sessions!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pool && *pool) {
|
||||
usepool = *pool;
|
||||
*pool = NULL;
|
||||
|
|
Loading…
Reference in New Issue