[Twisted-web] Newbie question : client connection lost

Phil Mayers p.mayers at imperial.ac.uk
Tue May 11 09:06:27 EDT 2010

On 11/05/10 14:46, Sebastien PASTOR wrote:
> It looks to me that this is what i am doin ... I really might be
> doing something wrong here but can t see what.
> The only difference with the livejournal's code is that i am trying to
> run a blocking code so i am doing a threads.deferToThread instead of doing a
> callLater.
> To test the connection lost, client side i am disabling the wifi while
> the server is blocking (sleeping). At the end of the blocking code:
> request.write() and finish() are done as if the connection was available
> and my ErrCallBack is not called.

If you're disabling the wi-fi, then you'll have to wait until the TCP 
connection timeout occurs. This might be a long, long time, or possibly 
never, if keepalives aren't enabled.

You could try enabling aggressive values for TCP keepalives on the 
underlying TCP connection, but I'm not sure that's advisable.

More information about the Twisted-web mailing list