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.
This commit is contained in:
William King 2014-02-21 14:11:54 -08:00
parent 199a64bf6a
commit 5fb660933d
1 changed files with 2 additions and 3 deletions

View 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;
}