import select, errno, sys
# Twisted imports
-from twisted.python import log, threadable, failure
+from twisted.python import log, failure
from twisted.internet import main, posixbase, error
#from twisted.internet.pollreactor import PollReactor, poller
class E2SharedPoll:
def __init__(self):
self.dict = { }
+ self.eApp = getApplication()
def register(self, fd, eventmask = select.POLLIN | select.POLLERR | select.POLLOUT):
self.dict[fd] = eventmask
del self.dict[fd]
def poll(self, timeout = None):
- r = getApplication().poll(timeout, self.dict)
+ try:
+ r = self.eApp.poll(timeout, self.dict)
+ except KeyboardInterrupt:
+ return None
return r
poller = E2SharedPoll()
else:
if selectables.has_key(fd): del selectables[fd]
- getApplication().interruptPoll()
+
+ poller.eApp.interruptPoll()
def _dictRemove(self, selectable, mdict):
try:
self._disconnectSelectable(selectable, why, inRead)
def callLater(self, *args, **kwargs):
- getApplication().interruptPoll()
+ poller.eApp.interruptPoll()
return posixbase.PosixReactorBase.callLater(self, *args, **kwargs)
def install():