python3: To be safe, abort entirely if initial epoller registration fails.
authorFredrik Tolf <fredrik@dolda2000.com>
Wed, 1 Feb 2017 04:02:22 +0000 (05:02 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Wed, 1 Feb 2017 04:02:22 +0000 (05:02 +0100)
python3/ashd/async.py

index 99da89a..aa52af9 100644 (file)
@@ -54,8 +54,12 @@ class epoller(object):
         ep = select.epoll()
         try:
             with self.lock:
-                for fd, (ob, evs) in self.registered.items():
-                    ep.register(fd, evs)
+                try:
+                    for fd, (ob, evs) in self.registered.items():
+                        ep.register(fd, evs)
+                except:
+                    self.registered.clear()
+                    raise
                 self.ep = ep
 
             while self.registered: