summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Connection.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2003-01-15 17:54:24 +0000
committerMarc Laukien <marc@zeroc.com>2003-01-15 17:54:24 +0000
commit18c4fbd25a501d244f281ba0c760472229b3b250 (patch)
tree52c1e8ff33c2d05e48fbd6171ed092608d9ce82a /cpp/src/Ice/Connection.cpp
parentfixed inc/decProxyCount & async requests (diff)
downloadice-18c4fbd25a501d244f281ba0c760472229b3b250.tar.bz2
ice-18c4fbd25a501d244f281ba0c760472229b3b250.tar.xz
ice-18c4fbd25a501d244f281ba0c760472229b3b250.zip
fixed inc/decProxyCount & async requests
Diffstat (limited to 'cpp/src/Ice/Connection.cpp')
-rw-r--r--cpp/src/Ice/Connection.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index fd740488944..d35c4177995 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -201,10 +201,16 @@ IceInternal::Connection::decProxyCount()
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
assert(_proxyCount > 0);
--_proxyCount;
- if(_proxyCount == 0 && !_adapter)
+
+ //
+ // We close the connection if
+ // - no proxy uses this connection anymore; and
+ // - there are not outstanding asynchronous requests; and
+ // - this is an outgoing connection only.
+ //
+ if(_proxyCount == 0 && _asyncRequests.empty() && !_adapter)
{
assert(_requests.empty());
- assert(_asyncRequests.empty());
setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
}
}
@@ -926,6 +932,18 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
{
_asyncRequests.erase(q);
}
+
+ //
+ // We close the connection if
+ // - no proxy uses this connection anymore; and
+ // - there are not outstanding asynchronous requests; and
+ // - this is an outgoing connection only.
+ //
+ if(_proxyCount == 0 && _asyncRequests.empty() && !_adapter)
+ {
+ assert(_requests.empty());
+ setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
+ }
}
break;