filepush: convert default buffersize into a #define
[openblackhole/openblackhole-enigma2.git] / e2reactor.py
index a3d8ce1..61447e2 100644 (file)
@@ -31,12 +31,15 @@ class E2SharedPoll:
 
        def register(self, fd, eventmask = select.POLLIN | select.POLLERR | select.POLLOUT):
                self.dict[fd] = eventmask
-       
+
        def unregister(self, fd):
                del self.dict[fd]
-       
+
        def poll(self, timeout = None):
-               r = self.eApp.poll(timeout, self.dict)
+               try:
+                       r = self.eApp.poll(timeout, self.dict)
+               except KeyboardInterrupt:
+                       return None
                return r
 
 poller = E2SharedPoll()
@@ -58,8 +61,8 @@ class PollReactor(posixbase.PosixReactorBase):
                        poller.register(fd, mask)
                else:
                        if selectables.has_key(fd): del selectables[fd]
-               
-               
+
+
                poller.eApp.interruptPoll()
 
        def _dictRemove(self, selectable, mdict):
@@ -122,7 +125,7 @@ class PollReactor(posixbase.PosixReactorBase):
                selectables.clear()
                for fd in fds:
                        poller.unregister(fd)
-                       
+
                if self.waker is not None:
                        self.addReader(self.waker)
                return result
@@ -136,7 +139,7 @@ class PollReactor(posixbase.PosixReactorBase):
                           POLLIN=select.POLLIN,
                           POLLOUT=select.POLLOUT):
                """Poll the poller for new events."""
-               
+
                if timeout is not None:
                        timeout = int(timeout * 1000) # convert seconds to milliseconds
 
@@ -163,7 +166,7 @@ class PollReactor(posixbase.PosixReactorBase):
 
        doIteration = doPoll
 
-       def _doReadOrWrite(self, selectable, fd, event, POLLIN, POLLOUT, log, 
+       def _doReadOrWrite(self, selectable, fd, event, POLLIN, POLLOUT, log,
                faildict={
                        error.ConnectionDone: failure.Failure(error.ConnectionDone()),
                        error.ConnectionLost: failure.Failure(error.ConnectionLost())
@@ -195,7 +198,7 @@ class PollReactor(posixbase.PosixReactorBase):
 
 def install():
        """Install the poll() reactor."""
-       
+
        p = PollReactor()
        main.installReactor(p)