summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-04-13 18:04:03 +0000
committerMarc Laukien <marc@zeroc.com>2002-04-13 18:04:03 +0000
commit08891cda4a66457aad4fd833df46d85190dbcc8b (patch)
tree3f21f1956e88f83e01684b97d9039b252d3ea2b9 /cpp/src
parentdefault identity fixed (diff)
downloadice-08891cda4a66457aad4fd833df46d85190dbcc8b.tar.bz2
ice-08891cda4a66457aad4fd833df46d85190dbcc8b.tar.xz
ice-08891cda4a66457aad4fd833df46d85190dbcc8b.zip
glacier fixes
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Connection.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index 81e43236ce0..9bc3b1dbde9 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -63,7 +63,8 @@ IceInternal::Connection::decProxyUsageCount()
{
IceUtil::RecMutex::Lock sync(*this);
assert(_proxyUsageCount > 0);
- if (--_proxyUsageCount == 0)
+ --_proxyUsageCount;
+ if (_proxyUsageCount == 0 && !_adapter)
{
assert(_requests.empty());
setState(StateClosing);
@@ -252,17 +253,32 @@ IceInternal::Connection::setAdapter(const ObjectAdapterPtr& adapter)
{
IceUtil::RecMutex::Lock sync(*this);
- if (adapter && !_adapter)
+ //
+ // In closed and holding state, we are not registered with the
+ // thread pool. For all other states, we have to notify the thread
+ // pool in case this event handler changed from a client to a
+ // server or vice versa.
+ //
+ if (_state != StateHolding && _state != StateClosed)
{
- _threadPool->clientIsNowServer();
+ if (adapter && !_adapter)
+ {
+ _threadPool->clientIsNowServer();
+ }
+
+ if (!adapter && _adapter)
+ {
+ _threadPool->serverIsNowClient();
+ }
}
- if (!adapter && _adapter)
+ _adapter = adapter;
+
+ if (_proxyUsageCount == 0 && !_adapter)
{
- _threadPool->serverIsNowClient();
+ assert(_requests.empty());
+ setState(StateClosing);
}
-
- _adapter = adapter;
}
ObjectAdapterPtr