[Zope-dev] Handling of ECONNRESET socket error in asyncore.py

Oliver Bleutgen myzope@gmx.net
Sat, 24 Aug 2002 20:00:55 +0200


Sorry, I forgot to answer one question.

Chris McDonough wrote:

 
> Did you read my suggestion for a new Zope feature e.g.
> REQUEST.RESPONSE.isClientConnected?  It would let the programmer
> explicitly decide when to stop processing based on the connection status
> of the browser.  Adding this feature would make it possible for a
> programmer to influence execution in arbitrary ways based on client TCP
> connection status without impacting backwards compatibility.  For
> example with your "slow/hanging page", maybe each iteration through a
> loop that obtains data from the database would check the flag and stop
> processing if the user has gone away, e.g.:
> 
> l = []
> while database.next():
>     # pretend "slow" inner loop
>     l.append(database.getData())
>     if not context.REQUEST.RESPONSE.isClientConnected():
>         return l
> return l

isClientConnected might be a good idea the same way that the abort() and 
other methods are a good idea in mod_perl.
That is, give the developer a possibility to check if the client is 
still able to read, i.e. still "there".
But that can't reduce the responsibility of zope in such cases IMO.

How exactly would you use isClientConnected with a "results" DTML-method 
calling a a ZSQL-method which hangs? ;-)

cheers,
oliver