> I've checked the Apache::SIG and $r->connection->aborted, but is there a
> way to "write" without actually writing, probably some control char will
> do? Something like:
>
> while(1){
> $r->print("\0");
> last if $r->connection->aborted;
> $i++;
> sleep (1);
> }
have a look at what Eric recently added to the api:
=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.
> See the output of strace, when I press Stop - it detects the SIGPIPE but
> doesn't quit!
...
> So Apache::SIG doesn't set correctly the mod_perl's default behaviour,
> since when I add:
>
> use Apache::SIG ();
> Apache::SIG->set;
hmm, I thought we were done with SIGPIPE, the patch below will re-enable
auto-calling of Apache::SIG->set
Index: mod_perl.c
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
retrieving revision 1.91
diff -u -u -r1.91 mod_perl.c
--- mod_perl.c 1999/08/16 07:50:15 1.91
+++ mod_perl.c 1999/11/01 07:15:47
@@ -484,14 +484,12 @@
exit(1);
}
-#if !HAS_MMN_136
static void set_sigpipe(void)
{
char *dargs[] = { NULL };
perl_require_module("Apache::SIG", NULL);
perl_call_argv("Apache::SIG::set", G_DISCARD, dargs);
}
-#endif
void perl_module_init(server_rec *s, pool *p)
{
@@ -543,9 +541,7 @@
if(PERL_RUNNING() && PERL_STARTUP_IS_DONE) {
saveINC;
mp_check_version();
-#if !HAS_MMN_136
set_sigpipe();
-#endif
}
if(perl_is_running == 0) {