[Twisted-Python] Bring multi service up gradually
David Pratt
fairwinds at eastlink.ca
Fri Jun 16 08:23:42 MDT 2006
Hi Thomas. Thank you for your reply. Yes, this might be a plan for
starting services. I'll look at how something like this could work with
my config since I am not using twisted app in this case but integrated
with another daemon service. Many thanks.
Regards,
David
Thomas Jacob wrote:
> Why not simply start the additional
> services from the startFactory-method of your mainservice'
> protocol factory?
>
> i,e,:
>
> class MainServiceFac(ServerFactory):
> def startFactory(self):
> <possibly call parent's startFactory>
> reactor.listenTCP(.... subservice 1)
> reactor.listenTCP(.... subservice 2)....
>
>
>
>
> On Fri, 2006-06-16 at 10:39 -0300, David Pratt wrote:
>> Chaz. wrote:
>>> I don't think there is a way to insure you will get the ports you want.
>>> Why bother testing if the port is available before hand? In between the
>>> port being tested and the application using it someone can sneak in and
>>> take it.
>> Hi Chaz. Thank you for your reply. The reason for the test is that I
>> don't want the other services to start at all if a connection cannot be
>> found to run the main service. I was thinking of writing a simple tester
>> using socket module to determine which addresses are alive first. When
>> it finds one it stops so in my logic I give this address to my
>> ListenTCP/SSL and attempt to start the main service.
>>
>> I don't expect the address list to be large. This way no time is lost
>> with the client running through a long backoff cycle on an address that
>> may not be alive only to have to stop it and try a another until one is
>> possibly found.
>>
>> I am not aware of something in twisted that evaluates addresses like
>> this as part of a startup solution. In any case, if I see that an
>> address in the list is available, then I would start my main service
>> using it. When a connection is made to the main address, then I want to
>> start the remaining services since they are useless without the main
>> service.
>>
>> Regards,
>> David
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
More information about the Twisted-Python
mailing list