[Twisted-Python] Missing feature in detecting stalled PB connections?

Itamar Shtull-Trauring itamar at itamarst.org
Tue Feb 21 10:58:17 MST 2006


On Tue, 2006-02-21 at 18:40 +0100, Luc Stepniewski wrote:
> On Tuesday 21 February 2006 17:06, Itamar Shtull-Trauring wrote:
> > The typical way to do this is have some sort of remote_ping method that
> > returns immediately on the server (or on the client) that the client (or
> > the server) calls every once in a while, with a timeout for the
> > response. If that times out the problem is likely the connection, not
> > the server being slow, in which case you can close the connection.
> 
> Yes, it's the same thing as making a pseudo "timeout" with a callLater. 

Not exactly. What I'm suggesting is a different command that you send in
addition to your regular operations. This extra command, "ping", is
expected to return a result quickly; if it doesn't you know something is
wrong. That way even if your regular commands take a really long time
for the server to process you can still tell if the server itself (or
your connection to it) is ok. Every 10 seconds, say, you ping the
server; if you don't get a response back in 5 seconds it's probably
down.





More information about the Twisted-Python mailing list