diff --git a/Net/include/Poco/Net/SocketConnector.h b/Net/include/Poco/Net/SocketConnector.h index fcfc83b29..d40403251 100644 --- a/Net/include/Poco/Net/SocketConnector.h +++ b/Net/include/Poco/Net/SocketConnector.h @@ -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. /// diff --git a/Net/src/PollSet.cpp b/Net/src/PollSet.cpp index dbc613778..f51480be2 100644 --- a/Net/src/PollSet.cpp +++ b/Net/src/PollSet.cpp @@ -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; } diff --git a/Net/src/SocketReactor.cpp b/Net/src/SocketReactor.cpp index 15af22d30..e68034dd9 100644 --- a/Net/src/SocketReactor.cpp +++ b/Net/src/SocketReactor.cpp @@ -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; } diff --git a/Net/testsuite/src/SocketReactorTest.cpp b/Net/testsuite/src/SocketReactorTest.cpp index d0aa37847..53d1578d9 100644 --- a/Net/testsuite/src/SocketReactorTest.cpp +++ b/Net/testsuite/src/SocketReactorTest.cpp @@ -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 {