Return-Path: Delivered-To: modperl-cvs-archive@hyperreal.org Received: (qmail 11515 invoked by uid 6000); 6 Oct 1999 17:43:48 -0000 Received: (qmail 11455 invoked by uid 246); 6 Oct 1999 17:43:46 -0000 Date: 6 Oct 1999 17:43:46 -0000 Message-ID: <19991006174346.11454.qmail@hyperreal.org> From: cholet@hyperreal.org To: modperl-cvs@apache.org Subject: cvs commit: modperl/Apache Apache.pm Sender: modperl-cvs-owner@apache.org Precedence: bulk Reply-To: modperl-cvs@apache.org cholet 99/10/06 10:43:45 Modified: . Changes src/modules/perl Connection.xs Apache Apache.pm Log: add $r->connection->fileno Revision Changes Path 1.349 +4 -0 modperl/Changes Index: Changes =================================================================== RCS file: /export/home/cvs/modperl/Changes,v retrieving revision 1.348 retrieving revision 1.349 diff -u -r1.348 -r1.349 --- Changes 1999/09/22 16:24:40 1.348 +++ Changes 1999/10/06 17:43:35 1.349 @@ -10,6 +10,10 @@ =item 1.21_01-dev +add $r->connection->fileno, provides the client file descriptors. This +can be used to detect client disconnect without doing any I/O, e.g. using +IO::Select [Eric Cholet ] + if $r->bytes_sent has not been calculated, then do so before returning the value. thanks to Dirk Melchers for the spot 1.6 +16 -0 modperl/src/modules/perl/Connection.xs Index: Connection.xs =================================================================== RCS file: /export/home/cvs/modperl/src/modules/perl/Connection.xs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Connection.xs 1999/09/09 09:40:31 1.5 +++ Connection.xs 1999/10/06 17:43:41 1.6 @@ -33,6 +33,22 @@ # * get_remote_host() */ int +fileno(conn, ...) + Apache::Connection conn + + PREINIT: + int sts = 1; /* default is output fd */ + + CODE: + if(items > 1) { + sts = (int)SvIV(ST(1)); + } + RETVAL = ap_bfileno(conn->client, sts ? B_WR : B_RD); + + OUTPUT: + RETVAL + +int aborted(conn) Apache::Connection conn 1.31 +9 -0 modperl/Apache/Apache.pm Index: Apache.pm =================================================================== RCS file: /export/home/cvs/modperl/Apache/Apache.pm,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- Apache.pm 1999/09/02 20:19:21 1.30 +++ Apache.pm 1999/10/06 17:43:43 1.31 @@ -531,6 +531,15 @@ Returns true if the client stopped talking to us. +=item $c->fileno( [$direction] ) + +Returns the client file descriptor. If $direction is 0, the input fd +is returned. If $direction is not null or ommitted, the output fd is +returned. + +This can be used to detect client disconnect without doing any I/O, +e.g. using IO::Select. + =back =back