]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ESL-82 --resolve
authorWilliam King <william.king@quentustech.com>
Fri, 21 Feb 2014 22:11:54 +0000 (14:11 -0800)
committerWilliam King <william.king@quentustech.com>
Fri, 21 Feb 2014 22:14:05 +0000 (14:14 -0800)
Previously any esl_connect_timeout() failures would not return to the calling application the reason for the failure.
This commit now allows for calling applications to know why the connection attempt fails, but it is now the calling
applications responsiblity to call esl_disconnect() on the esl handle after the failure. Failing to call disconnect after
a failed connection attempt would result in memory being leaked.

libs/esl/src/esl.c

index 587db6c75e07085012499d1a976d807c309af9d3..bf9d3499dd19506b3fa34c6546803c8ae088f141 100644 (file)
@@ -967,7 +967,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
        int err = WSAStartup(wVersionRequested, &wsaData);
        if (err != 0) {
                snprintf(handle->err, sizeof(handle->err), "WSAStartup Error");
-               return ESL_FAIL;
+               goto fail;
        }
 
 #endif
@@ -1009,7 +1009,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
        
        if (handle->sock == ESL_SOCK_INVALID) {
                snprintf(handle->err, sizeof(handle->err), "Socket Error");
-               return ESL_FAIL;
+               goto fail;
        }
 
        if (timeout) {
@@ -1110,7 +1110,6 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
  fail:
 
        handle->connected = 0;
-       esl_disconnect(handle);
 
        return ESL_FAIL;
 }