diff options
author | Clifford Allan Jansen <cliffjansen@apache.org> | 2014-02-05 06:46:44 +0000 |
---|---|---|
committer | Clifford Allan Jansen <cliffjansen@apache.org> | 2014-02-05 06:46:44 +0000 |
commit | 393032c64fc33199bb70c3352bd3280ce02410d9 (patch) | |
tree | f887afe59466a2a0bdac3608ccdba6396b6f858d | |
parent | 9f8588ce9a1bcd0c3510ff7e19e78ce793cbaadf (diff) | |
download | qpid-python-393032c64fc33199bb70c3352bd3280ce02410d9.tar.gz |
QPID-5540: use mutex to ensure single SCHANNEL_SHUTDOWN
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1564644 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp | 16 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/sys/windows/SslAsynchIO.h | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp b/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp index a733ece74c..00fd96b6ef 100644 --- a/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp +++ b/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp @@ -182,15 +182,19 @@ void SslAsynchIO::notifyPendingWrite() { } void SslAsynchIO::queueWriteClose() { - if (state == Negotiating) { - // Never got going, so don't bother trying to close SSL down orderly. + { + qpid::sys::Mutex::ScopedLock l(lock); + if (state == Negotiating) { + // Never got going, so don't bother trying to close SSL down orderly. + state = ShuttingDown; + aio->queueWriteClose(); + return; + } + if (state == ShuttingDown) + return; state = ShuttingDown; - aio->queueWriteClose(); - return; } - state = ShuttingDown; - DWORD shutdown = SCHANNEL_SHUTDOWN; SecBuffer shutBuff; shutBuff.cbBuffer = sizeof(DWORD); diff --git a/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.h b/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.h index f80285c305..aab5c0021e 100644 --- a/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.h +++ b/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.h @@ -26,6 +26,7 @@ #include "qpid/sys/IntegerTypes.h" #include "qpid/sys/Poller.h" #include "qpid/CommonImportExport.h" +#include "qpid/sys/Mutex.h" #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <windows.h> @@ -86,6 +87,7 @@ protected: // AsynchIO layer below that's actually doing the I/O qpid::sys::AsynchIO *aio; + Mutex lock; // Track what the state of the SSL session is. Have to know when it's // time to notify the upper layer that the session is up, and also to |