summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--socket_notify.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/socket_notify.py b/socket_notify.py
index 6a56e71..0ab5dd6 100644
--- a/socket_notify.py
+++ b/socket_notify.py
@@ -35,6 +35,8 @@ class Monitor(asyncore.dispatcher):
def __init__(self, path, phenny):
asyncore.dispatcher.__init__(self)
self.phenny = phenny
+ self.phenny._orig_close = self.phenny.close
+ self.phenny.close = (lambda: self._phenny_close())
self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
@@ -52,7 +54,11 @@ class Monitor(asyncore.dispatcher):
os.umask(old_mask)
self.listen(5)
-
+
+ def _phenny_close(self):
+ self.close()
+ self.phenny._orig_close()
+
def handle_accept(self):
pair = self.accept()
if pair is not None: