Remove some unnecessary code that was holding locks on the session
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12651 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
10a4b302ff
commit
31aefe6ef8
|
@ -541,8 +541,6 @@ static switch_status_t check_attached_sessions(listener_t *listener)
|
|||
|
||||
/* event is a channel destroy, so this session can be removed */
|
||||
if (pevent->event_id == SWITCH_EVENT_CHANNEL_DESTROY) {
|
||||
switch_core_session_t *session;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy event for attached session for %s\n", sp->uuid_str);
|
||||
|
||||
/* remove session from list */
|
||||
|
@ -551,10 +549,6 @@ static switch_status_t check_attached_sessions(listener_t *listener)
|
|||
else
|
||||
listener->session_list = sp->next;
|
||||
|
||||
if ((session = switch_core_session_locate(sp->uuid_str))) {
|
||||
switch_channel_clear_flag(switch_core_session_get_channel(session), CF_CONTROLLED);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
/* this allows the application threads to exit */
|
||||
switch_clear_flag_locked(sp, LFLAG_SESSION_ALIVE);
|
||||
removed = 1;
|
||||
|
@ -1041,14 +1035,9 @@ session_elem_t* attach_call_to_registered_process(listener_t* listener, char* re
|
|||
{
|
||||
/* create a session list element */
|
||||
session_elem_t* session_element = NULL;
|
||||
if (!(session_element = switch_core_alloc(switch_core_session_get_pool(session), sizeof(*session_element)))) {
|
||||
if (!(session_element = switch_core_session_alloc(session, sizeof(*session_element)))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to allocate session element\n");
|
||||
}
|
||||
else {
|
||||
if (SWITCH_STATUS_SUCCESS != switch_core_session_read_lock(session)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get session read lock\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
session_element->process.type = ERLANG_REG_PROCESS;
|
||||
session_element->process.reg_name = switch_core_strdup(switch_core_session_get_pool(session),reg_name);
|
||||
switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
|
||||
|
@ -1058,7 +1047,6 @@ session_elem_t* attach_call_to_registered_process(listener_t* listener, char* re
|
|||
/* attach the session to the listener */
|
||||
add_session_elem_to_listener(listener,session_element);
|
||||
}
|
||||
}
|
||||
return session_element;
|
||||
}
|
||||
|
||||
|
@ -1066,14 +1054,9 @@ session_elem_t* attach_call_to_pid(listener_t* listener, erlang_pid* pid, switch
|
|||
{
|
||||
/* create a session list element */
|
||||
session_elem_t* session_element = NULL;
|
||||
if (!(session_element = switch_core_alloc(switch_core_session_get_pool(session), sizeof(*session_element)))) {
|
||||
if (!(session_element = switch_core_session_alloc(session, sizeof(*session_element)))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to allocate session element\n");
|
||||
}
|
||||
else {
|
||||
if (SWITCH_STATUS_SUCCESS != switch_core_session_read_lock(session)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get session read lock\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
memcpy(session_element->uuid_str, switch_core_session_get_uuid(session), SWITCH_UUID_FORMATTED_LENGTH);
|
||||
session_element->process.type = ERLANG_PID;
|
||||
memcpy(&session_element->process.pid, pid, sizeof(erlang_pid));
|
||||
|
@ -1086,7 +1069,6 @@ session_elem_t* attach_call_to_pid(listener_t* listener, erlang_pid* pid, switch
|
|||
|
||||
ei_link(listener, ei_self(listener->ec), pid);
|
||||
}
|
||||
}
|
||||
return session_element;
|
||||
}
|
||||
|
||||
|
@ -1094,13 +1076,9 @@ session_elem_t* attach_call_to_spawned_process(listener_t* listener, char *modul
|
|||
{
|
||||
/* create a session list element */
|
||||
session_elem_t* session_element=NULL;
|
||||
if (!(session_element = switch_core_alloc(switch_core_session_get_pool(session), sizeof(*session_element)))) {
|
||||
if (!(session_element = switch_core_session_alloc(session, sizeof(*session_element)))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to allocate session element\n");
|
||||
} else {
|
||||
if (SWITCH_STATUS_SUCCESS != switch_core_session_read_lock(session)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get session read lock\n");
|
||||
}
|
||||
else {
|
||||
char hash[100];
|
||||
int i = 0;
|
||||
void *p = NULL;
|
||||
|
@ -1171,7 +1149,6 @@ session_elem_t* attach_call_to_spawned_process(listener_t* listener, char *modul
|
|||
|
||||
ei_link(listener, ei_self(listener->ec), pid);
|
||||
}
|
||||
}
|
||||
return session_element;
|
||||
}
|
||||
|
||||
|
@ -1276,9 +1253,8 @@ SWITCH_STANDARD_APP(erlang_outbound_function)
|
|||
|
||||
/* keep app thread running for lifetime of session */
|
||||
if (switch_channel_down(switch_core_session_get_channel(session))) {
|
||||
while (switch_test_flag(session_element, LFLAG_SESSION_ALIVE)) {
|
||||
switch_yield(100000);
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "outbound session all done\n");
|
||||
switch_clear_flag_locked(session_element, LFLAG_SESSION_ALIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue