Geoffrey Young wrote:
> 
> my $fileno = $r->connection->fileno;
> 
> $s = IO::Select->new($fileno);
> 
> die "aborted" if grep { m/$fileno/ } $s->can_read(1);
> 
> HTH
> 

Thanks for this.  The code that I ended up using for Apache::ASP was:

    # IsClientConnected ?  Might already be disconnected for busy site, if
    # a user hits stop/reload
    my $is_connected = 1;
    my $fileno = $r->connection->fileno;
    if(defined $fileno) {
        my $s = IO::Select->new($fileno);
        if($s->can_read(0)) {
            $is_connected = 0;
        }
    }

The difference being the can_read(0) from can_read(1).
The 1 would create an unnecessary wait of 1 second I found,
whereas 0 does not, yet reports the aborted condition
accurately.

Thanks again!

-- Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

Reply via email to