diff options
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/Loop.cxx | 3 | ||||
-rw-r--r-- | src/event/MultiSocketMonitor.hxx | 1 | ||||
-rw-r--r-- | src/event/ServerSocket.cxx | 3 | ||||
-rw-r--r-- | src/event/SignalMonitor.cxx | 8 | ||||
-rw-r--r-- | src/event/SocketMonitor.cxx | 2 | ||||
-rw-r--r-- | src/event/SocketMonitor.hxx | 5 |
6 files changed, 8 insertions, 14 deletions
diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx index 58c25e040..6281b09ec 100644 --- a/src/event/Loop.cxx +++ b/src/event/Loop.cxx @@ -42,9 +42,6 @@ EventLoop::~EventLoop() { assert(idle.empty()); assert(timers.empty()); - - /* avoid closing the WakeFD twice */ - SocketMonitor::Steal(); } void diff --git a/src/event/MultiSocketMonitor.hxx b/src/event/MultiSocketMonitor.hxx index d6ad3b177..963745be1 100644 --- a/src/event/MultiSocketMonitor.hxx +++ b/src/event/MultiSocketMonitor.hxx @@ -143,7 +143,6 @@ public: i->SetEvents(events); prev = i; } else { - i->Steal(); fds.erase_after(prev); } } diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index a05d7bde2..64e38776f 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -90,6 +90,9 @@ public: ~OneServerSocket() { g_free(address); + + if (IsDefined()) + Close(); } unsigned GetSerial() const { diff --git a/src/event/SignalMonitor.cxx b/src/event/SignalMonitor.cxx index bb75f49a3..eac011616 100644 --- a/src/event/SignalMonitor.cxx +++ b/src/event/SignalMonitor.cxx @@ -58,14 +58,6 @@ public: #endif } - ~SignalMonitor() { - /* prevent the descriptor to be closed twice */ -#ifdef USE_SIGNALFD - if (SocketMonitor::IsDefined()) -#endif - SocketMonitor::Steal(); - } - using SocketMonitor::GetEventLoop; #ifdef USE_SIGNALFD diff --git a/src/event/SocketMonitor.cxx b/src/event/SocketMonitor.cxx index 92693949f..ef2128684 100644 --- a/src/event/SocketMonitor.cxx +++ b/src/event/SocketMonitor.cxx @@ -43,7 +43,7 @@ SocketMonitor::Dispatch(unsigned flags) SocketMonitor::~SocketMonitor() { if (IsDefined()) - Close(); + Cancel(); } void diff --git a/src/event/SocketMonitor.hxx b/src/event/SocketMonitor.hxx index 3a84dc094..d0fcf1b57 100644 --- a/src/event/SocketMonitor.hxx +++ b/src/event/SocketMonitor.hxx @@ -44,6 +44,9 @@ class EventLoop; * #EventLoop will invoke virtual method OnSocketReady() as soon as * any of the subscribed events are ready. * + * This class does not feel responsible for closing the socket. Call + * Close() to do it manually. + * * This class is not thread-safe, all methods must be called from the * thread that runs the #EventLoop, except where explicitly documented * as thread-safe. @@ -91,7 +94,7 @@ public: /** * "Steal" the socket descriptor. This abandons the socket - * and puts the responsibility for closing it to the caller. + * and returns it. */ int Steal(); |