[Twisted-Python] LoopingCall question : ping w/ timeout using shared variable -> problem

Gabriel Rossetti gabriel.rossetti at arimaz.com
Thu Sep 25 03:33:39 MDT 2008

Hello everyone!

I have written some code uses a LoopingCall to send a "ping" at regular 
intervals. If it hasn't received an answer before the next call, it 
notifies me that the destination isn't available, if it does then it 
does nothing. I am getting lots of "unavailables" on hosts that are, I 
tried augmenting the timeout (the ping interval) and it doesn't change 
anything. I think what is happening is I'm using a simple variable to 
keep the availability state and that since protocol and the 
LoopingCall's callback both access the variable, this causes problems. 
Is there a better way of doing things or am I bound to use some sort of 
locking mechanism? If I have to use locking, which one do you recommend?

Thank you,

More information about the Twisted-Python mailing list