diff options
-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 |