[Twisted-Python] Factory.startFactory being called twice.
andrew-twisted at puzzling.org
andrew-twisted at puzzling.org
Tue Jan 29 16:56:40 MST 2002
Hi all,
I recently upgraded to 0.14.0, but I'm still seeing Factory.startFactory()
being called twice when I start my server.
If I start my server with the following code (adapted from simpleserv.py):
app = Application('spam')
app.listenTCP(1234,MyFactory())
app.run(save=0)
Then by using traceback.format_stack() in MyFactory.startFactory I can see
that it gets called twice, here:
app.run(save=0)
File "F:\Python22\Lib\site-packages\twisted\internet\app.py", line 350, in run
port.startListening()
File "F:\Python22\Lib\site-packages\twisted\internet\tcp.py", line 395, in startListening
self.factory.startFactory()
and here:
app.run(save=0)
File "F:\Python22\Lib\site-packages\twisted\internet\app.py", line 357, in run
port.factory.startFactory()
I'm currently using
if not hasattr(self, 'once'):
self.once = 1
# ...
To workaround it, but it'd be nice to not need to do this.
The docs suggest that it will get called twice, "both after an application
has been unserialized and before all the ports begin accepting connections."
Which is fine, except that I'm not unserialising...
It's a minor glitch in an otherwise beautiful system :)
-Andrew.
More information about the Twisted-Python
mailing list