switch_core_session_t *session = NULL;
if (uuid_str) {
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.session_hash_mutex);
if ((session = switch_core_hash_find(session_manager.session_table, uuid_str))) {
/* Acquire a read lock on the session */
#ifdef SWITCH_DEBUG_RWLOCKS
session = NULL;
}
}
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.session_hash_mutex);
}
/* if its not NULL, now it's up to you to rwunlock this */
if (!var_val) return;
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.session_hash_mutex);
for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
if (val) {
}
}
}
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.session_hash_mutex);
}
SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause)
void *val;
switch_core_session_t *session;
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.session_hash_mutex);
for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
if (val) {
}
}
}
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.session_hash_mutex);
}
SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
uint32_t loops = 0;
while (session_manager.session_count > 0) {
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.session_hash_mutex);
for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
if (val) {
}
}
}
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.session_hash_mutex);
switch_yield(1000000);
if (++loops == 30) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Giving up with %d session%s remaining\n",
switch_core_session_t *session = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.session_hash_mutex);
if ((session = switch_core_hash_find(session_manager.session_table, uuid_str)) != 0) {
/* Acquire a read lock on the session or forget it the channel is dead */
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
switch_core_session_rwunlock(session);
}
}
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.session_hash_mutex);
return status;
}
switch_core_session_t *session = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.session_hash_mutex);
if ((session = switch_core_hash_find(session_manager.session_table, uuid_str)) != 0) {
/* Acquire a read lock on the session or forget it the channel is dead */
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
switch_core_session_rwunlock(session);
}
}
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.session_hash_mutex);
return status;
}
switch_scheduler_del_task_group((*session)->uuid_str);
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.session_hash_mutex);
switch_core_hash_delete(session_manager.session_table, (*session)->uuid_str);
if (session_manager.session_count) {
session_manager.session_count--;
}
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.session_hash_mutex);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DESTROY) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data((*session)->channel, event);
switch_event_create(&event, SWITCH_EVENT_CHANNEL_UUID);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Old-Unique-ID", session->uuid_str);
- switch_mutex_lock(runtime.throttle_mutex);
+ switch_mutex_lock(runtime.session_hash_mutex);
switch_core_hash_delete(session_manager.session_table, session->uuid_str);
switch_set_string(session->uuid_str, use_uuid);
switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
- switch_mutex_unlock(runtime.throttle_mutex);
+ switch_mutex_unlock(runtime.session_hash_mutex);
switch_channel_event_set_data(session->channel, event);
switch_event_fire(&event);
switch_queue_create(&session->message_queue, SWITCH_MESSAGE_QUEUE_LEN, session->pool);
switch_queue_create(&session->event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
- switch_mutex_lock(runtime.throttle_mutex);
- session->id = session_manager.session_id++;
+
+ switch_mutex_lock(runtime.session_hash_mutex);
switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
+ session->id = session_manager.session_id++;
session_manager.session_count++;
- switch_mutex_unlock(runtime.throttle_mutex);
-
+ switch_mutex_unlock(runtime.session_hash_mutex);
+
return session;
}