lib/PublicInbox/Daemon.pm | 2 ++ lib/PublicInbox/HTTP.pm | 2 +- lib/PublicInbox/HTTPD.pm | 1 + lib/PublicInbox/IMAP.pm | 2 +- lib/PublicInbox/NNTP.pm | 2 +- lib/PublicInbox/POP3.pm | 1 + diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 0043d21eef4be44b7f391d6d1ce4099d2f091d20..bb140640c3219ec7f69b6cf9ab853039fc9fb893 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -134,6 +134,8 @@ $p = File::Spec->canonpath($p->[0]); $tlsd->{$f} = $logs{$p} //= open_log_path(my $fh, $p); warn "# $scheme://$addr $f=$p\n"; } + my $err = $tlsd->{err}; + $tlsd->{warn_cb} = sub { print $err @_ }; # for local $SIG{__WARN__} \%xn; } diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 3d4e34995dfbd9f11749c052ec7f6766331177f5..0dba425dd6354d4925fa82b49a24ea669a16db76 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -69,7 +69,7 @@ } sub event_step { # called by PublicInbox::DS my ($self) = @_; - + local $SIG{__WARN__} = $self->{srv_env}->{'pi-httpd.warn_cb'}; return unless $self->flush_write && $self->{sock}; # only read more requests if we've drained the write buffer, diff --git a/lib/PublicInbox/HTTPD.pm b/lib/PublicInbox/HTTPD.pm index e531ee707e6d0a81cd85dd8eee6e31f399105c3f..bae7281b7979f92b483a0a26c5cc7f542f7f3464 100644 --- a/lib/PublicInbox/HTTPD.pm +++ b/lib/PublicInbox/HTTPD.pm @@ -47,6 +47,7 @@ # We also check for the truthiness of this to # detect when to use async paths for slow blobs 'pi-httpd.async' => \&pi_httpd_async, 'pi-httpd.app' => $self->{app}, + 'pi-httpd.warn_cb' => $self->{warn_cb}, } } diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 605c5e515110d1b0f1a077be70174149a78b22de..2be1b763f30a89f12e84a8c1fa0339026cf3937d 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -1186,7 +1186,7 @@ # callback used by PublicInbox::DS for any (e)poll (in/out/hup/err) sub event_step { my ($self) = @_; - + local $SIG{__WARN__} = $self->{imapd}->{warn_cb}; return unless $self->flush_write && $self->{sock} && !$self->{long_cb}; # only read more requests if we've drained the write buffer, diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 524784cb90ac3a6dfabc29f030d5e7cd32fe2704..ef01f44886203abdeaa3b07dad35226a9e7d6770 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -958,7 +958,7 @@ # callback used by PublicInbox::DS for any (e)poll (in/out/hup/err) sub event_step { my ($self) = @_; - + local $SIG{__WARN__} = $self->{nntpd}->{warn_cb}; return unless $self->flush_write && $self->{sock} && !$self->{long_cb}; # only read more requests if we've drained the write buffer, diff --git a/lib/PublicInbox/POP3.pm b/lib/PublicInbox/POP3.pm index 7469922b2249f405be5a012eaa25e66c681087da..53fb2e05900b0b94f1a112189817fc12571ae0b6 100644 --- a/lib/PublicInbox/POP3.pm +++ b/lib/PublicInbox/POP3.pm @@ -351,6 +351,7 @@ # callback used by PublicInbox::DS for any (e)poll (in/out/hup/err) sub event_step { my ($self) = @_; + local $SIG{__WARN__} = $self->{pop3d}->{warn_cb}; return unless $self->flush_write && $self->{sock} && !$self->{long_cb}; # only read more requests if we've drained the write buffer,