From f59d63d73f52dc2dad7390b43f964196e369df92 Mon Sep 17 00:00:00 2001 From: Marc Laukien Date: Fri, 31 May 2002 00:08:10 +0000 Subject: fixed thread pool registration bug --- cpp/src/Ice/ConnectionFactory.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'cpp/src/Ice/ConnectionFactory.cpp') diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 522354d3cc2..27d8bc94c6c 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -432,7 +432,8 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance _endpoint(endpoint), _adapter(adapter), _state(StateHolding), - _finished(false) + _finished(false), + _registeredWithPool(false) { DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); if (defaultsAndOverrides->overrideTimeout) @@ -554,12 +555,16 @@ IceInternal::IncomingConnectionFactory::registerWithPool() { if (_acceptor) { - if (!_serverThreadPool) + if (!_registeredWithPool) { - _serverThreadPool = _instance->serverThreadPool(); - assert(_serverThreadPool); + if (!_serverThreadPool) + { + _serverThreadPool = _instance->serverThreadPool(); + assert(_serverThreadPool); + } + _serverThreadPool->_register(_acceptor->fd(), this); + _registeredWithPool = true; } - _serverThreadPool->_register(_acceptor->fd(), this); } } @@ -568,7 +573,11 @@ IceInternal::IncomingConnectionFactory::unregisterWithPool() { if (_acceptor) { - assert(_serverThreadPool); - _serverThreadPool->unregister(_acceptor->fd()); + if (_registeredWithPool) + { + assert(_serverThreadPool); + _serverThreadPool->unregister(_acceptor->fd()); + _registeredWithPool = false; + } } } -- cgit v1.2.3