summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Connection.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-05-31 00:08:10 +0000
committerMarc Laukien <marc@zeroc.com>2002-05-31 00:08:10 +0000
commitf59d63d73f52dc2dad7390b43f964196e369df92 (patch)
tree6e5093e7d628f52ba0ec5061b611930508a5d74f /cpp/src/Ice/Connection.cpp
parentglacier batching fixes (diff)
downloadice-f59d63d73f52dc2dad7390b43f964196e369df92.tar.bz2
ice-f59d63d73f52dc2dad7390b43f964196e369df92.tar.xz
ice-f59d63d73f52dc2dad7390b43f964196e369df92.zip
fixed thread pool registration bug
Diffstat (limited to 'cpp/src/Ice/Connection.cpp')
-rw-r--r--cpp/src/Ice/Connection.cpp53
1 files changed, 32 insertions, 21 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index 9a57f741ece..098b9a20aab 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -802,7 +802,8 @@ IceInternal::Connection::Connection(const InstancePtr& instance,
_batchStream(_instance),
_responseCount(0),
_proxyUsageCount(0),
- _state(StateHolding)
+ _state(StateHolding),
+ _registeredWithPool(false)
{
_warn = _instance->properties()->getPropertyAsInt("Ice.ConnectionWarnings") > 0;
}
@@ -974,38 +975,48 @@ IceInternal::Connection::closeConnection()
void
IceInternal::Connection::registerWithPool()
{
- if (_adapter)
+ if (!_registeredWithPool)
{
- if (!_serverThreadPool)
+ if (_adapter)
{
- _serverThreadPool = _instance->serverThreadPool();
- assert(_serverThreadPool);
+ if (!_serverThreadPool)
+ {
+ _serverThreadPool = _instance->serverThreadPool();
+ assert(_serverThreadPool);
+ }
+ _serverThreadPool->_register(_transceiver->fd(), this);
}
- _serverThreadPool->_register(_transceiver->fd(), this);
- }
- else
- {
- if (!_clientThreadPool)
+ else
{
- _clientThreadPool = _instance->clientThreadPool();
- assert(_clientThreadPool);
+ if (!_clientThreadPool)
+ {
+ _clientThreadPool = _instance->clientThreadPool();
+ assert(_clientThreadPool);
+ }
+ _clientThreadPool->_register(_transceiver->fd(), this);
}
- _clientThreadPool->_register(_transceiver->fd(), this);
+
+ _registeredWithPool = true;
}
}
void
IceInternal::Connection::unregisterWithPool()
{
- if (_adapter)
+ if (_registeredWithPool)
{
- assert(_serverThreadPool);
- _serverThreadPool->unregister(_transceiver->fd());
- }
- else
- {
- assert(_clientThreadPool);
- _clientThreadPool->unregister(_transceiver->fd());
+ if (_adapter)
+ {
+ assert(_serverThreadPool);
+ _serverThreadPool->unregister(_transceiver->fd());
+ }
+ else
+ {
+ assert(_clientThreadPool);
+ _clientThreadPool->unregister(_transceiver->fd());
+ }
+
+ _registeredWithPool = false;
}
}