From: Gunnar Beutner Date: Fri, 27 Feb 2015 08:03:23 +0000 (+0100) Subject: Fix another potential hang in TlsStream::Handshake X-Git-Tag: v2.3.0~106 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9567cd663bd0823189d8b0046b5d00b217692560;p=icinga2 Fix another potential hang in TlsStream::Handshake refs #8550 --- diff --git a/lib/base/stdiostream.cpp b/lib/base/stdiostream.cpp index bf9c928e8..140117b98 100644 --- a/lib/base/stdiostream.cpp +++ b/lib/base/stdiostream.cpp @@ -63,5 +63,5 @@ void StdioStream::Close(void) bool StdioStream::IsEof(void) const { - return m_InnerStream->eof(); + return !m_InnerStream->good(); } diff --git a/lib/base/tlsstream.cpp b/lib/base/tlsstream.cpp index c4fb0d72d..7d9c0ce26 100644 --- a/lib/base/tlsstream.cpp +++ b/lib/base/tlsstream.cpp @@ -131,7 +131,7 @@ void TlsStream::OnEvent(int revents) char buffer[512]; if (m_CurrentAction == TlsActionNone) { - if (revents & POLLIN) + if (revents & (POLLIN | POLLERR | POLLHUP)) m_CurrentAction = TlsActionRead; else if (m_SendQ->GetAvailableBytes() > 0 && (revents & POLLOUT)) m_CurrentAction = TlsActionWrite;