[icinga-checkins] icinga.org: icinga2/master: Improve error handling for TlsStream:: Handshake

git at icinga.org git at icinga.org
Wed May 11 10:13:52 CEST 2016


Module: icinga2
Branch: master
Commit: 2adfcb56fe682ca01988cdd8e11eced14fa49f27
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=2adfcb56fe682ca01988cdd8e11eced14fa49f27

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed May 11 10:09:54 2016 +0200

Improve error handling for TlsStream::Handshake

fixes #11046

---

 lib/base/tlsstream.cpp |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/base/tlsstream.cpp b/lib/base/tlsstream.cpp
index 93a7501..c4074ea 100644
--- a/lib/base/tlsstream.cpp
+++ b/lib/base/tlsstream.cpp
@@ -268,9 +268,12 @@ void TlsStream::Handshake(void)
 	m_CurrentAction = TlsActionHandshake;
 	ChangeEvents(POLLOUT);
 
-	while (!m_HandshakeOK && !m_ErrorOccurred)
+	while (!m_HandshakeOK && !m_ErrorOccurred && !m_Eof)
 		m_CV.wait(lock);
 
+	if (m_Eof)
+		BOOST_THROW_EXCEPTION(std::runtime_error("Socket was closed during TLS handshake."));
+
 	HandleError();
 }
 



More information about the icinga-checkins mailing list