From dd8e6089c78e03a369ac08db82bff9c251b5b63b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 5 Jan 2012 08:49:56 -0600 Subject: [PATCH] FS-3798 --resolve --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index e873114ed4..edfd291501 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -2468,6 +2468,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_channel_t *channel = NULL; switch_event_t *revent = NULL; const char *var; + int locked = 1; switch_mutex_lock(globals.listener_mutex); prefs.threads++; @@ -2477,6 +2478,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) if ((session = listener->session)) { if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { + locked = 0; goto done; } } @@ -2655,7 +2657,9 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) if (listener->session) { switch_channel_clear_flag(switch_core_session_get_channel(listener->session), CF_CONTROLLED); switch_clear_flag_locked(listener, LFLAG_SESSION); - switch_core_session_rwunlock(listener->session); + if (locked) { + switch_core_session_rwunlock(listener->session); + } } else if (listener->pool) { switch_memory_pool_t *pool = listener->pool; switch_core_destroy_memory_pool(&pool);