-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
I found a possible problem that could end up with unusable tcp server.
In function TCPServerDispatcher::run() the line std::auto_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket())); create application TCP handler.
If for some reason the creation throw exeption (for example because do something with a broken socket or similar) the thread return in pool and so no problem because try catch is taken but we jump the line
--_currentThreads; so in the end, after some of this issue you will refuse all new connection because in function void TCPServerDispatcher::enqueue(const StreamSocket& socket) we check _currentThreads < _pParams->getMaxThreads()
So I think we should put --_currentThreads; in a "scoped decrement" class or try catch the createConnection.