mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 17:25:03 +02:00
TCPServerDispatcher: fix thread accounting leak (#1801)
* TCPServerDispatcher::run: catch errors in connection creation and handling to prevent threads from exiting without accounting for them
This commit is contained in:
parent
6c13f5d14c
commit
4da941f869
@ -18,6 +18,7 @@
|
||||
#include "Poco/Net/TCPServerConnectionFactory.h"
|
||||
#include "Poco/Notification.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/ErrorHandler.h"
|
||||
#include <memory>
|
||||
|
||||
|
||||
@ -104,6 +105,7 @@ void TCPServerDispatcher::run()
|
||||
|
||||
for (;;)
|
||||
{
|
||||
try {
|
||||
AutoPtr<Notification> pNf = _queue.waitDequeueNotification(idleTime);
|
||||
if (pNf)
|
||||
{
|
||||
@ -121,6 +123,19 @@ void TCPServerDispatcher::run()
|
||||
endConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Poco::Exception &exc)
|
||||
{
|
||||
ErrorHandler::handle(exc);
|
||||
}
|
||||
catch (std::exception &exc)
|
||||
{
|
||||
ErrorHandler::handle(exc);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
ErrorHandler::handle();
|
||||
}
|
||||
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
if (_stopped || (_currentThreads > 1 && _queue.empty()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user