From 5fb660933d8971ec2245d899490bc2b802270230 Mon Sep 17 00:00:00 2001 From: William King Date: Fri, 21 Feb 2014 14:11:54 -0800 Subject: [PATCH] ESL-82 --resolve 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 587db6c75e..bf9d3499dd 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -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; }