[Twisted-Python] How to make a service dependent of another?
terry at jon.es
Fri May 15 04:46:00 EDT 2009
>>>>> "Gus" == coder gus <coder_gus at lavabit.com> writes:
Gus> I have a pb client and a tcp server. How can I make the server start
Gus> only after/if the client started?
You might take a look at the code here
and if you go back a couple of mails in that thread you'll see some more
discussion. BTW, this approach hasn't received much comment, so you
shouldn't assume it's bulletproof or even recommended. But I use it many
times every day to launch about half a dozen twistd multiservices, and have
never had a problem.
You use it like a regular multiservice, but you can pass it a service which
is treated slightly specially. The other services you add will not be
started unless the service you pass to __init__ starts properly (you can
know this by having its startService return a deferred). Make sense?
More information about the Twisted-Python