mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
PollSet behaves differently on windows #2313
This commit is contained in:
parent
2c445f3fb1
commit
82c88a238c
@ -68,7 +68,7 @@ class SocketConnector
|
||||
/// The ServiceHandler class must provide a constructor that
|
||||
/// takes a StreamSocket and a SocketReactor as arguments,
|
||||
/// e.g.:
|
||||
/// MyServiceHandler(const StreamSocket& socket, ServiceReactor& reactor)
|
||||
/// MyServiceHandler(const StreamSocket& socket, SocketReactor& reactor)
|
||||
///
|
||||
/// When the ServiceHandler is done, it must destroy itself.
|
||||
///
|
||||
|
@ -211,7 +211,7 @@ private:
|
||||
|
||||
|
||||
//
|
||||
// BSD/Windows implementation using poll
|
||||
// BSD/Windows implementation using poll/WSAPoll
|
||||
//
|
||||
class PollSetImpl
|
||||
{
|
||||
@ -355,6 +355,10 @@ public:
|
||||
result[its->second] |= PollSet::POLL_WRITE;
|
||||
if (it->revents & POLLERR)
|
||||
result[its->second] |= PollSet::POLL_ERROR;
|
||||
#ifdef _WIN32
|
||||
if (it->revents & POLLHUP)
|
||||
result[its->second] |= PollSet::POLL_READ;
|
||||
#endif
|
||||
}
|
||||
it->revents = 0;
|
||||
}
|
||||
|
@ -117,14 +117,16 @@ bool SocketReactor::hasSocketHandlers()
|
||||
{
|
||||
ScopedLock lock(_mutex);
|
||||
|
||||
if (_pollSet.empty()) return false;
|
||||
|
||||
for (EventHandlerMap::iterator it = _handlers.begin(); it != _handlers.end(); ++it)
|
||||
if (!_pollSet.empty())
|
||||
{
|
||||
if (it->second->accepts(_pReadableNotification) ||
|
||||
it->second->accepts(_pWritableNotification) ||
|
||||
it->second->accepts(_pErrorNotification)) return true;
|
||||
for (EventHandlerMap::iterator it = _handlers.begin(); it != _handlers.end(); ++it)
|
||||
{
|
||||
if (it->second->accepts(_pReadableNotification) ||
|
||||
it->second->accepts(_pWritableNotification) ||
|
||||
it->second->accepts(_pErrorNotification)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace
|
||||
class EchoServiceHandler
|
||||
{
|
||||
public:
|
||||
EchoServiceHandler(StreamSocket& socket, SocketReactor& reactor):
|
||||
EchoServiceHandler(const StreamSocket& socket, SocketReactor& reactor):
|
||||
_socket(socket),
|
||||
_reactor(reactor)
|
||||
{
|
||||
@ -87,7 +87,7 @@ namespace
|
||||
class ClientServiceHandler
|
||||
{
|
||||
public:
|
||||
ClientServiceHandler(StreamSocket& socket, SocketReactor& reactor):
|
||||
ClientServiceHandler(const StreamSocket& socket, SocketReactor& reactor):
|
||||
_socket(socket),
|
||||
_reactor(reactor),
|
||||
_or(*this, &ClientServiceHandler::onReadable),
|
||||
@ -123,12 +123,6 @@ namespace
|
||||
_str.write(buffer, n);
|
||||
_data += _str.str();
|
||||
_str.str("");
|
||||
if ((_once && _data.size() == 1024) ||
|
||||
(!_once && _data.size() == 8192))
|
||||
{
|
||||
_reactor.stop();
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user