From: Mathieu Rene Date: Tue, 20 Jul 2010 20:11:59 +0000 (-0400) Subject: esl: use recv_timed in esl_connect_timemout in case we get stuck in a blocking recv X-Git-Tag: v1.2-rc1~526^2~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13137e228c591f23a0d0a8187b0b9ef4d0923e8a;p=thirdparty%2Ffreeswitch.git esl: use recv_timed in esl_connect_timemout in case we get stuck in a blocking recv --- diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index c63f2b1a00..4084578217 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -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;