perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Valdemar Mørch <pe...@morch.com>
Subject Re: User abort/stop, modperl 2 and TCP FIN / RST?
Date Mon, 11 Jun 2012 23:13:54 GMT
On Mon, Jun 11, 2012 at 12:29 PM, André Warnier <aw@ice-sa.com> wrote:
> Just my two cent, maybe just to dampen your expectations a little bit.
> This topic is probably as old as the WWW itself, and there just is no magic
> bullet here.
...
> But if your ultimate aim is to find a way where instant detection is
> guaranteed, then give it up.  It is just not possible, given how the
> Internet, and TCP/IP and HTTP work.

I was certain that normal cgis under Apache2 reacted immediately to
aborts. I was wrong ( As I discovered in my quest to devise a test
case proving you wrong... ;-) )

Ok, we're doing the best we can then. Fine. At least the next guy that
comes along will have this thread to read.

So pseudocode for the magic incantation then seems to be:

    while (! $done) {
        heavyCalculationBite();
        $r->print($msg);
        # Eval needed to support < 2.0.6 that dies if $r->connection->aborted
        eval {
            $r->rflush();
        };
        if ($r->connection->aborted) {
            # Handle user abort
            last;
        }
    }

Thank you so much for your enlightening replies!

Peter
-- 
Peter Valdemar Mørch
http://www.morch.com

Mime
View raw message