aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-11-28 15:50:58 +0100
committerMartin Willi <martin@revosec.ch>2014-11-28 15:53:50 +0100
commit4ef819a37936ccc9bd1a33c4e708e9ec62042a6f (patch)
tree9fa742eb93c2926c8352f41f5abe2eba23664b5f
parent015fb3134db41ca9901ec5c895b15f5a37590ddc (diff)
downloadstrongswan-4ef819a37936ccc9bd1a33c4e708e9ec62042a6f.tar.bz2
strongswan-4ef819a37936ccc9bd1a33c4e708e9ec62042a6f.tar.xz
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.
-rw-r--r--src/libtls/tls_socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libtls/tls_socket.c b/src/libtls/tls_socket.c
index 9427b677c..2ccd97571 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)