[Twisted-Python] unlistenTCP not working?
mporter at despammed.com
Thu Jul 24 13:15:28 EDT 2003
I'm having a problem with unlistenTCP - it doesn't seem to work if
application.listenTCP was called after the reactor is started. Am I missing
something here or is this a bug? See test code below for demonstration...
def listen(application, port):
from twisted.web import server, resource
print "called listen %d" % port
def unlisten(application, port):
print "called unlisten %d" % port
from twisted.python import log
from twisted.internet import app, reactor
application = app.Application("test")
reactor.callLater(0, listen, application, 8080)
reactor.callLater(5, unlisten, application, 8080)
If you call test(listenFirst = 1) then all works as expected (log shows it
starts listening immediately and stops after 5 secs). But if you start
listening by scheduling a call after application.run (call test(listenFirst
= 0)) the listenTCP works but when unlisten is called 5 secs later it
doesn't seem to stop listening and nothing appears in the log.
(I'm running on Windows with twisted 1.0.6)
Any ideas? Thanks,
More information about the Twisted-Python