add PollSet::has/empty(); ParallelAcceptor: always use same reactor for a socket, if registered

This commit is contained in:
Alex Fabijanic
2018-05-01 13:23:21 -05:00
committed by Alex Fabijanic
parent f6e6bec32d
commit df46368413
8 changed files with 139 additions and 31 deletions

View File

@@ -116,6 +116,9 @@ void SocketReactor::run()
bool SocketReactor::hasSocketHandlers()
{
ScopedLock lock(_mutex);
if (_pollSet.empty()) return false;
for (EventHandlerMap::iterator it = _handlers.begin(); it != _handlers.end(); ++it)
{
if (it->second->accepts(_pReadableNotification) ||
@@ -219,6 +222,12 @@ void SocketReactor::removeEventHandler(const Socket& socket, const Poco::Abstrac
}
bool SocketReactor::has(const Socket& socket) const
{
return _pollSet.has(socket);
}
void SocketReactor::onTimeout()
{
dispatch(_pTimeoutNotification);