summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-07-21 11:16:00 +0200
committerBenoit Foucher <benoit@zeroc.com>2014-07-21 11:16:00 +0200
commit6a50ea5b6b2869925172a68bd3337f2f6832b8b5 (patch)
tree1c95012fcb155dbf92def98ed6a3c0280cc325b3 /cpp/src
parentICE-5316 added pos method to BasicStream that works for both read/write (diff)
downloadice-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/src')
-rw-r--r--cpp/src/Ice/EventHandler.h1
-rw-r--r--cpp/src/Ice/ThreadPool.h7
-rw-r--r--cpp/src/IceSSL/SecureTransportTransceiverI.cpp7
-rw-r--r--cpp/src/IceSSL/TransceiverI.cpp7
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)
{
//