twistedhub: add boolean 'disconnected' attribute to socket_rwdescriptor

this helps run glib2reactor and gtk2reactor
This commit is contained in:
Denis Bilenko
2009-06-16 01:41:59 +07:00
parent 96c16d924c
commit f52e0cf396

View File

@@ -65,6 +65,9 @@ def callLater(DelayedCallClass, reactor, _seconds, _f, *args, **kw):
class socket_rwdescriptor: class socket_rwdescriptor:
#implements(IReadWriteDescriptor) #implements(IReadWriteDescriptor)
# required by glib2reactor
disconnected = False
def __init__(self, fileno, read, write, error): def __init__(self, fileno, read, write, error):
self._fileno = fileno self._fileno = fileno
self.read = read self.read = read
@@ -80,6 +83,7 @@ class socket_rwdescriptor:
self.write(self) self.write(self)
def connectionLost(self, reason): def connectionLost(self, reason):
self.disconnected = True
if self.error: if self.error:
self.error(self, reason) self.error(self, reason)
# trampoline() will now throw() into the greenlet that owns the socket # trampoline() will now throw() into the greenlet that owns the socket