summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Connection.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-09-04 02:11:46 +0000
committerMichi Henning <michi@zeroc.com>2003-09-04 02:11:46 +0000
commit5ecbdf0ebe5efd151129d4422b30b7aefe11f9db (patch)
treefca4840b748039de1d06e78170bb3c6ca23f6933 /cpp/src/Ice/Connection.cpp
parentFixed IcePack test cleaning (diff)
downloadice-5ecbdf0ebe5efd151129d4422b30b7aefe11f9db.tar.bz2
ice-5ecbdf0ebe5efd151129d4422b30b7aefe11f9db.tar.xz
ice-5ecbdf0ebe5efd151129d4422b30b7aefe11f9db.zip
Fixed race condition in flushBatchRequests(): connections that are not yet
validated are now ignored when flushing.
Diffstat (limited to 'cpp/src/Ice/Connection.cpp')
-rw-r--r--cpp/src/Ice/Connection.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index 9fcfae99fa7..d23fa6ce8f7 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -340,6 +340,13 @@ IceInternal::Connection::validate()
setState(StateHolding);
}
+bool
+IceInternal::Connection::isValidated() const
+{
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ return _state > StateNotValidated;
+}
+
void
IceInternal::Connection::incProxyCount()
{
@@ -376,7 +383,8 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway)
{
_exception->ice_throw();
}
- assert(_state > StateNotValidated && _state < StateClosing);
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
Int requestId;
@@ -486,7 +494,8 @@ IceInternal::Connection::sendAsyncRequest(const OutgoingAsyncPtr& out)
{
_exception->ice_throw();
}
- assert(_state > StateNotValidated && _state < StateClosing);
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
Int requestId;
@@ -590,7 +599,8 @@ IceInternal::Connection::prepareBatchRequest(BasicStream* os)
unlock();
_exception->ice_throw();
}
- assert(_state > StateNotValidated && _state < StateClosing);
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
if(_batchStream.b.empty())
{
@@ -622,7 +632,8 @@ IceInternal::Connection::finishBatchRequest(BasicStream* os)
unlock();
_exception->ice_throw();
}
- assert(_state > StateNotValidated && _state < StateClosing);
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
_batchStream.swap(*os); // Get the batch stream back.
++_batchRequestNum; // Increment the number of requests in the batch.
@@ -645,7 +656,8 @@ IceInternal::Connection::flushBatchRequest()
{
_exception->ice_throw();
}
- assert(_state > StateNotValidated && _state < StateClosing);
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
if(!_batchStream.b.empty())
{