]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5325
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 24 Apr 2013 15:12:42 +0000 (10:12 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 24 Apr 2013 15:50:36 +0000 (10:50 -0500)
libs/iksemel/.update
libs/iksemel/src/stream.c

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f8d85b56a5f2ed91cf7bd017244ac70a21301830 100644 (file)
@@ -0,0 +1 @@
+Wed Apr 24 10:12:23 CDT 2013
index a1a4494e5981b127777e5a5fc6cada7c60fd3c7c..f8a0355b61614d4448e77aa7702f0086a71c1d76 100644 (file)
@@ -93,7 +93,7 @@ static int sock_read_ready(struct stream_data *data, int ms)
        int s = 0, r = 0;
        
        pfds[0].fd = SSL_get_fd(data->ssl);
-       pfds[0].events |= POLLIN;
+       pfds[0].events = POLLIN | POLLHUP | POLLERR;
        
        s = poll(pfds, 1, ms);
 
@@ -103,6 +103,8 @@ static int sock_read_ready(struct stream_data *data, int ms)
        } else if (s > 0) {
                if ((pfds[0].revents & POLLIN)) {
                        r = 1;
+               } else if ((pfds[0].revents & POLLHUP) || (pfds[0].revents & POLLERR)) {
+                       r = -1;
                }
        }
 
@@ -690,7 +692,9 @@ iks_recv (iksparser *prs, int timeout)
                        } else if( ret == 0 ) {
                                return IKS_OK;
                        } else {
-                               len = SSL_read(data->ssl, data->buf, NET_IO_BUF_SIZE - 1);
+                               do {
+                                       len = SSL_read(data->ssl, data->buf, NET_IO_BUF_SIZE - 1);
+                               } while (len == -1 && (errno == EAGAIN || errno == EINTR || SSL_get_error(data->ssl, len) == SSL_ERROR_WANT_READ));
                        }
                        
                        if( len <= 0 )