From f8dc87bd18e6a75bd6665e2a330e26679891655e Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 13 Nov 2019 17:56:57 +0400 Subject: [PATCH] [mod_event_socket] Fix "Listener session is null" problem - regression from previous commit to the mod. --- .../mod_event_socket/mod_event_socket.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) 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 192b81c1f4..c8d8a23501 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 @@ -2635,16 +2635,12 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_assert(listener != NULL); - if (!(session = listener->session)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Listener session is null!\n"); - switch_clear_flag_locked(listener, LFLAG_RUNNING); - goto done; - } - - if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unable to lock session!\n"); - locked = 0; - goto done; + if ((session = listener->session)) { + if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unable to lock session!\n"); + locked = 0; + goto done; + } } if (!listener->sock) {