diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/SocketReader.cpp | 1 | ||||
-rw-r--r-- | src/server/SocketServer.hpp | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/SocketReader.cpp b/src/SocketReader.cpp index d57cda29..c9b31cb5 100644 --- a/src/SocketReader.cpp +++ b/src/SocketReader.cpp @@ -154,6 +154,7 @@ SocketReader::run() // Wait for input to arrive at socket int ret = poll(&pfd, 1, -1); if (ret == -1 || (pfd.revents & (POLLERR|POLLHUP|POLLNVAL))) { + on_hangup(); break; // Hangup } else if (!ret) { continue; // No data, shouldn't happen diff --git a/src/server/SocketServer.hpp b/src/server/SocketServer.hpp index a1811334..fc9fdeae 100644 --- a/src/server/SocketServer.hpp +++ b/src/server/SocketServer.hpp @@ -47,7 +47,15 @@ public: } ~SocketServer() { + if (_writer) { + _engine.unregister_client(_writer); + } + } + +protected: + void on_hangup() { _engine.unregister_client(_writer); + _writer.reset(); } private: |