From: Martin Willi Date: Fri, 28 Nov 2014 14:50:58 +0000 (+0100) Subject: libtls: Catch POLLHUP/NVAL in TLS socket splicing X-Git-Tag: 5.2.2dr1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ef819a37936ccc9bd1a33c4e708e9ec62042a6f;p=thirdparty%2Fstrongswan.git libtls: Catch POLLHUP/NVAL in TLS socket splicing If one of the sockets gets disconnected, some systems return POLLHUP. Signal the socket as ready to let the read/write call fail properly. --- diff --git a/src/libtls/tls_socket.c b/src/libtls/tls_socket.c index 9427b677c8..2ccd975713 100644 --- a/src/libtls/tls_socket.c +++ b/src/libtls/tls_socket.c @@ -308,7 +308,7 @@ METHOD(tls_socket_t, splice, bool, DBG1(DBG_TLS, "TLS select error: %s", strerror(errno)); return FALSE; } - while (!plain_eof && pfd[0].revents & POLLIN) + while (!plain_eof && pfd[0].revents & (POLLIN | POLLHUP | POLLNVAL)) { in = read_(this, buf, sizeof(buf), FALSE); switch (in) @@ -341,7 +341,7 @@ METHOD(tls_socket_t, splice, bool, } break; } - if (!crypto_eof && pfd[1].revents & POLLIN) + if (!crypto_eof && pfd[1].revents & (POLLIN | POLLHUP | POLLNVAL)) { in = read(rfd, buf, sizeof(buf)); switch (in)