diff options
author | Marc Laukien <marc@zeroc.com> | 2002-04-13 14:20:11 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-04-13 14:20:11 +0000 |
commit | 14eb5a90dadb90493192b35dcc241068a9c99550 (patch) | |
tree | b565a551fbfa6163de72015135b424c531a40930 /cpp/src/Ice/ConnectionFactory.cpp | |
parent | brought getLocalHost() back (diff) | |
download | ice-14eb5a90dadb90493192b35dcc241068a9c99550.tar.bz2 ice-14eb5a90dadb90493192b35dcc241068a9c99550.tar.xz ice-14eb5a90dadb90493192b35dcc241068a9c99550.zip |
fixes for the thread pool
Diffstat (limited to 'cpp/src/Ice/ConnectionFactory.cpp')
-rw-r--r-- | cpp/src/Ice/ConnectionFactory.cpp | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 378ce96d84a..9495c50983f 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -358,41 +358,45 @@ IceInternal::IncomingConnectionFactory::finished() { IceUtil::Mutex::Lock sync(*this); + assert(_state == StateClosed || _state == StateHolding); + _threadPool->promoteFollower(); - assert(_state == StateClosed); - assert(_connections.empty()); - - try + if (_state == StateClosed) { - // - // Clear listen() backlog properly by accepting all queued - // connections, and then shutting them down. - // - while (true) + assert(_connections.empty()); + + try { - try - { - TransceiverPtr transceiver = _acceptor->accept(0); - ConnectionPtr connection = new Connection(_instance, transceiver, _endpoint, _adapter); - connection->exception(ObjectAdapterDeactivatedException(__FILE__, __LINE__)); - } - catch (const TimeoutException&) + // + // Clear listen() backlog properly by accepting all queued + // connections, and then shutting them down. + // + while (true) { - break; // Exit loop on timeout. + try + { + TransceiverPtr transceiver = _acceptor->accept(0); + ConnectionPtr connection = new Connection(_instance, transceiver, _endpoint, _adapter); + connection->exception(ObjectAdapterDeactivatedException(__FILE__, __LINE__)); + } + catch (const TimeoutException&) + { + break; // Exit loop on timeout. + } } } - } - catch (const LocalException& ex) - { - if (_warn) + catch (const LocalException& ex) { - Warning out(_instance->logger()); - out << "connection exception:\n" << ex << '\n' << _acceptor->toString(); + if (_warn) + { + Warning out(_instance->logger()); + out << "connection exception:\n" << ex << '\n' << _acceptor->toString(); + } } + + _acceptor->close(); } - - _acceptor->close(); } void @@ -493,7 +497,7 @@ IceInternal::IncomingConnectionFactory::setState(State state) if (_threadPool) { - _threadPool->unregister(_acceptor->fd(), false); + _threadPool->unregister(_acceptor->fd()); } for_each(_connections.begin(), _connections.end(), ::Ice::voidMemFun(&Connection::hold)); @@ -512,7 +516,7 @@ IceInternal::IncomingConnectionFactory::setState(State state) { _threadPool->_register(_acceptor->fd(), this); } - _threadPool->unregister(_acceptor->fd(), true); + _threadPool->unregister(_acceptor->fd()); } #ifdef _STLP_BEGIN_NAMESPACE |