[Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16
fabian.rothfuchs at googlemail.com
Mon Sep 19 14:03:20 EDT 2011
>One thing you can do is make a small initial startup method that
>you supply to reactor.callLater with a delay of 0, that does the loop on
>the connectTCP()'s. It will start up your initial set of connections.
Thanks John, this was *really* helpful!
I now did the following:
1. On Startup, the application starts one threaded reactor with a NOP
connects to 127.0.0.1:9 (discard socket).
2. The adapters use that threaded reactor as follows:
>>>for host in hosts:
>>> ...host, port = (host, 23)
>>> ...d = defer.Deferred()
>>> ...from twisted.internet import reactor
>>> ...factory = S12ClientFactory(d, username='root', password='admin')
>>> ...reactor.connectTCP(host, port, factory, timeout=5)
>>> ...d.addCallbacks(success, error)
The second important part was the wakeUp() call, which apparently triggers
To end all blocking tasks.
My appreciations to Jeff and Johann as well for their help!
More information about the Twisted-Python