doh FS-3423

This commit is contained in:
Tamas Cseke 2012-05-24 16:19:01 +02:00
parent 377f6a9ef6
commit 9dc9ee974c
1 changed files with 2 additions and 4 deletions

View File

@ -320,7 +320,6 @@ static void add_session_elem_to_listener(listener_t *listener, session_elem_t *s
}
/* TODO lock */
static void remove_session_elem_from_listener(listener_t *listener, session_elem_t *session_element)
{
switch_core_hash_delete(listener->sessions, session_element->uuid_str);
@ -789,10 +788,9 @@ static void handle_exit(listener_t *listener, erlang_pid * pid)
/* TODO - eliminate session destroy races and we shouldn't lock the session hash */
switch_thread_rwlock_wrlock(listener->session_rwlock);
if ((s = find_session_elem_by_pid(listener, pid))) {
if (remove_session_elem_from_listener(listener, s) == SWITCH_STATUS_SUCCESS) {
remove_session_elem_from_listener(listener, s);
destroy_session_elem(s);
}
}
switch_thread_rwlock_wrlock(listener->session_rwlock);