]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix regression from recent refactor that causes infinite loop on unexpected disconnect
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 21 Nov 2013 23:53:34 +0000 (04:53 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 21 Nov 2013 23:53:34 +0000 (04:53 +0500)
libs/esl/src/esl.c

index 67b82fbe6d4d0032d76022ff8eaebcef93bae70f..e8ed39aa68abdd9855937d63f74ec6c61d4e969b 100644 (file)
@@ -1231,8 +1231,9 @@ static esl_ssize_t handle_recv(esl_handle_t *handle, void *data, esl_size_t data
                        if ((activity & ESL_POLL_ERROR)) {
                                activity = -1;
                        } else if ((activity & ESL_POLL_READ)) {
-                               activity = recv(handle->sock, data, datalen, 0);
-                               if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
+                               if (!(activity = recv(handle->sock, data, datalen, 0))) {
+                                       activity = -1;
+                               } else if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
                                        activity = 0;
                                }
                        }