]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3798 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 5 Jan 2012 14:49:56 +0000 (08:49 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 5 Jan 2012 14:49:56 +0000 (08:49 -0600)
src/mod/event_handlers/mod_event_socket/mod_event_socket.c

index e873114ed4fe023881b987ea9d694e0a40a41bfd..edfd2915014283d1201dea6a99cb34172696dfb7 100644 (file)
@@ -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);