esl: use recv_timed in esl_connect_timemout in case we get stuck in a blocking recv

This commit is contained in:
Mathieu Rene 2010-07-20 16:11:59 -04:00
parent 8a7f38c650
commit 13137e228c
1 changed files with 6 additions and 2 deletions

View File

@ -713,7 +713,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
handle->connected = 1;
if (esl_recv(handle)) {
if (esl_recv_timed(handle, timeout)) {
snprintf(handle->err, sizeof(handle->err), "Connection Error");
goto fail;
}
@ -734,7 +734,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
esl_send(handle, sendbuf);
if (esl_recv(handle)) {
if (esl_recv_timed(handle, timeout)) {
snprintf(handle->err, sizeof(handle->err), "Authentication Error");
goto fail;
}
@ -813,6 +813,10 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms
}
esl_mutex_unlock(handle->mutex);
}
if (ms == -1) {
ms = 30000;
}
tv.tv_usec = ms * 1000;