[Twisted-Python] Waiting for transports to close
Chris Norman
chris.norman2 at googlemail.com
Wed Dec 16 10:25:51 MST 2015
Hi all,
I'm writing a MUD server, and I want a way for transports to be notified
ofa shutdown before being disconnected, and the reactor being stopped.
I've tried:
for t in transports:
t.write('Shutting down.\r\n')
t.loseConnection()
reactor.stop()
This doesn't seem to notify the transports.
I also tried:
for t in transports:
t.write('Shutting down.\r\n')
t.loseConnection()
while t.connected:
pass
reactor.stop()
That just blocked and did nothing, presumably something do with my while
loop.
Is there a stopWhenEmpty function on the somewhere? I did look over the
methods, and I couldn't find anything promising.
I'm just using the standard from twisted.internet import reactor
reactor, so no special cases here. In case it matters the transports I'm
using are twisted.protocols.basic.LineReceiver, and everything else
works with them.
Cheers in advance for the help.
More information about the Twisted-Python
mailing list