mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-27 12:14:32 +00:00
Fix removing sessions from linked list; fix a deadlock added in previous commit
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12634 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
a7d7c0ba88
commit
8928727293
@ -487,6 +487,7 @@ static switch_status_t check_attached_sessions(listener_t *listener)
|
|||||||
session_elem_t *last,*sp;
|
session_elem_t *last,*sp;
|
||||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
void *pop;
|
void *pop;
|
||||||
|
int removed = 0;
|
||||||
/* check up on all the attached sessions -
|
/* check up on all the attached sessions -
|
||||||
if they have not yet sent an initial call event to the associated erlang process then do so
|
if they have not yet sent an initial call event to the associated erlang process then do so
|
||||||
if they have pending events in their queues then send them
|
if they have pending events in their queues then send them
|
||||||
@ -496,6 +497,7 @@ static switch_status_t check_attached_sessions(listener_t *listener)
|
|||||||
sp = listener->session_list;
|
sp = listener->session_list;
|
||||||
last = NULL;
|
last = NULL;
|
||||||
while(sp) {
|
while(sp) {
|
||||||
|
removed = 0;
|
||||||
if (switch_test_flag(sp, LFLAG_WAITING_FOR_PID)) {
|
if (switch_test_flag(sp, LFLAG_WAITING_FOR_PID)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -538,6 +540,7 @@ static switch_status_t check_attached_sessions(listener_t *listener)
|
|||||||
/* this allows the application threads to exit */
|
/* this allows the application threads to exit */
|
||||||
switch_clear_flag_locked(sp, LFLAG_SESSION_ALIVE);
|
switch_clear_flag_locked(sp, LFLAG_SESSION_ALIVE);
|
||||||
switch_core_session_rwunlock(sp->session);
|
switch_core_session_rwunlock(sp->session);
|
||||||
|
removed = 1;
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
if this listener was created outbound, and the last session has been detached
|
if this listener was created outbound, and the last session has been detached
|
||||||
@ -548,6 +551,7 @@ static switch_status_t check_attached_sessions(listener_t *listener)
|
|||||||
ei_x_free(&ebuf);
|
ei_x_free(&ebuf);
|
||||||
switch_event_destroy(&pevent);
|
switch_event_destroy(&pevent);
|
||||||
}
|
}
|
||||||
|
if (!removed)
|
||||||
last = sp;
|
last = sp;
|
||||||
sp = sp->next;
|
sp = sp->next;
|
||||||
}
|
}
|
||||||
@ -1321,10 +1325,10 @@ SWITCH_STANDARD_API(erlang_cmd)
|
|||||||
stream->write_function(stream, "Outbound session for %s\n", switch_core_session_get_uuid(sp->session));
|
stream->write_function(stream, "Outbound session for %s\n", switch_core_session_get_uuid(sp->session));
|
||||||
sp = sp->next;
|
sp = sp->next;
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(l->session_mutex);
|
|
||||||
} else {
|
} else {
|
||||||
stream->write_function(stream, "No active sessions for %s\n", argv[1]);
|
stream->write_function(stream, "No active sessions for %s\n", argv[1]);
|
||||||
}
|
}
|
||||||
|
switch_mutex_unlock(l->session_mutex);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user