From f67a11c183077969405c7c5507e4e38df759e095 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 16 Oct 2014 13:11:14 +0200 Subject: [PATCH] Don't log error messages when TLS connections are closed refs #7244 --- lib/base/tlsstream.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/base/tlsstream.cpp b/lib/base/tlsstream.cpp index 347dd67c7..a050f7fa5 100644 --- a/lib/base/tlsstream.cpp +++ b/lib/base/tlsstream.cpp @@ -200,8 +200,10 @@ size_t TlsStream::Read(void *buffer, size_t count) Close(); return count - left; default: - msgbuf << "SSL_read() failed with code " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\""; - Log(LogCritical, "TlsStream", msgbuf.str()); + if (ERR_peek_error() != 0) { + msgbuf << "SSL_read() failed with code " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\""; + Log(LogCritical, "TlsStream", msgbuf.str()); + } BOOST_THROW_EXCEPTION(openssl_error() << boost::errinfo_api_function("SSL_read") @@ -260,8 +262,10 @@ void TlsStream::Write(const void *buffer, size_t count) Close(); return; default: - msgbuf << "SSL_write() failed with code " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\""; - Log(LogCritical, "TlsStream", msgbuf.str()); + if (ERR_peek_error() != 0) { + msgbuf << "SSL_write() failed with code " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\""; + Log(LogCritical, "TlsStream", msgbuf.str()); + } BOOST_THROW_EXCEPTION(openssl_error() << boost::errinfo_api_function("SSL_write")