]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
kill socket in esl_disconnect to prevent blocking
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 20 Nov 2013 18:50:15 +0000 (23:50 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 20 Nov 2013 18:50:15 +0000 (23:50 +0500)
libs/esl/src/esl.c

index 7a29844ab42c226962a10382e69323e3e5091b78..67b82fbe6d4d0032d76022ff8eaebcef93bae70f 100644 (file)
@@ -1123,6 +1123,12 @@ ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle)
                return ESL_FAIL;
        }
 
+       if (handle->sock != ESL_SOCK_INVALID) {
+               closesocket(handle->sock);
+               handle->sock = ESL_SOCK_INVALID;
+               status = ESL_SUCCESS;
+       }
+
        if (mutex) {
                esl_mutex_lock(mutex);
        }
@@ -1145,12 +1151,6 @@ ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle)
        esl_event_safe_destroy(&handle->last_ievent);
        esl_event_safe_destroy(&handle->info_event);
 
-       if (handle->sock != ESL_SOCK_INVALID) {
-               closesocket(handle->sock);
-               handle->sock = ESL_SOCK_INVALID;
-               status = ESL_SUCCESS;
-       }
-       
        if (mutex) {
                esl_mutex_unlock(mutex);
                esl_mutex_lock(mutex);