diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-07-21 11:16:00 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-07-21 11:16:00 +0200 |
commit | 6a50ea5b6b2869925172a68bd3337f2f6832b8b5 (patch) | |
tree | 1c95012fcb155dbf92def98ed6a3c0280cc325b3 /cpp | |
parent | ICE-5316 added pos method to BasicStream that works for both read/write (diff) | |
download | ice-6a50ea5b6b2869925172a68bd3337f2f6832b8b5.tar.bz2 ice-6a50ea5b6b2869925172a68bd3337f2f6832b8b5.tar.xz ice-6a50ea5b6b2869925172a68bd3337f2f6832b8b5.zip |
Fixed race condition which could cause request to be dispatched even if the connection was just put on hold
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/EventHandler.h | 1 | ||||
-rw-r--r-- | cpp/src/Ice/ThreadPool.h | 7 | ||||
-rw-r--r-- | cpp/src/IceSSL/SecureTransportTransceiverI.cpp | 7 | ||||
-rw-r--r-- | cpp/src/IceSSL/TransceiverI.cpp | 7 |
4 files changed, 21 insertions, 1 deletions
diff --git a/cpp/src/Ice/EventHandler.h b/cpp/src/Ice/EventHandler.h index ad4407650c0..705efd208d9 100644 --- a/cpp/src/Ice/EventHandler.h +++ b/cpp/src/Ice/EventHandler.h @@ -69,6 +69,7 @@ protected: SocketOperation _registered; friend class ThreadPool; + friend class ThreadPoolCurrent; friend class Selector; }; diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h index d8e0b85dcd1..b7dcbf3cf42 100644 --- a/cpp/src/Ice/ThreadPool.h +++ b/cpp/src/Ice/ThreadPool.h @@ -188,6 +188,11 @@ public: { _threadPool->finishMessage(const_cast<ThreadPoolCurrent&>(*this)); } +#else + bool ioReady() + { + return _handler->_registered & operation; + } #endif void dispatchFromThisThread(const DispatchWorkItemPtr& workItem) @@ -276,7 +281,7 @@ public: operator bool() { - return true; + return _message._current.ioReady(); // Ensure the handler is still interested in the operation. } void completed() diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp index bd25cf57c08..6454743acb5 100644 --- a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +++ b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp @@ -568,6 +568,13 @@ IceSSL::TransceiverI::write(IceInternal::Buffer& buf) IceInternal::SocketOperation IceSSL::TransceiverI::read(IceInternal::Buffer& buf, bool&) { + // + // Note: we don't set the hasMoreData flag in this implementation. + // We assume that SecureTransport doesn't read more SSL records + // than necessary to fill the requested data and that the sender + // sends Ice messages in individual SSL records. + // + if(_state == StateProxyConnectRequestPending) { // diff --git a/cpp/src/IceSSL/TransceiverI.cpp b/cpp/src/IceSSL/TransceiverI.cpp index 597faa8e923..3fde67ef906 100644 --- a/cpp/src/IceSSL/TransceiverI.cpp +++ b/cpp/src/IceSSL/TransceiverI.cpp @@ -622,6 +622,13 @@ IceSSL::TransceiverI::write(IceInternal::Buffer& buf) IceInternal::SocketOperation IceSSL::TransceiverI::read(IceInternal::Buffer& buf, bool&) { + // + // Note: we don't set the hasMoreData flag in this implementation. + // We assume that OpenSSL doesn't read more SSL records than + // necessary to fill the requested data and that the sender sends + // Ice messages in individual SSL records. + // + if(_state == StateProxyConnectRequestPending) { // |