From f3d55848f562e0eb09a7743f76ef725a755282c5 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 5 Aug 2014 09:35:28 +0200 Subject: [PATCH] Add a missing lock in TlsStream::Close fixes #6621 refs #6724 --- lib/base/tlsstream.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/base/tlsstream.cpp b/lib/base/tlsstream.cpp index a7ab8f3b8..a75c7a9c5 100644 --- a/lib/base/tlsstream.cpp +++ b/lib/base/tlsstream.cpp @@ -235,14 +235,18 @@ void TlsStream::Close(void) for (int i = 0; i < 5; i++) { int rc, err; - do { + { + boost::mutex::scoped_lock lock(m_SSLLock); rc = SSL_shutdown(m_SSL.get()); - } while (rc == 0); - if (rc > 0) - break; + if (rc == 0) + continue; - err = SSL_get_error(m_SSL.get(), rc); + if (rc > 0) + break; + + err = SSL_get_error(m_SSL.get(), rc); + } switch (err) { case SSL_ERROR_WANT_READ: