> > class TCPClient(Axon.Component.component):
> > def __init__(self,host,port,delay=0,connect_timeout=60):
> > self.connect_timeout = connect_timeout
> > ...
> > connect_start = time.time()
> > while not self.safeConnect(sock,(self.host, self.port)):
> > if self.shutdown():
> > return
> > if ( time.time() - connect_start ) > self.connect_timeout:
> > self.howDied = "timeout"
> > raise Finality
> > yield 1
I just updated to my tcpclient to get the timeout you checked in. May
I suggest rearranging the math a little to take it out of the loop:
waitTill = time.time() + self.connect_timeout
while not self.safeConnect(sock,(self.host,
self.port)):
if self.shutdown():
return
if time.time() >= self.connect_timeout:
self.howDied = "timeout"
raise Finality
yield 1
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"kamaelia" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/kamaelia?hl=en
-~----------~----~----~----~------~----~------~--~---