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