From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 09853200FC for ; Fri, 25 Sep 2015 02:28:00 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/8] nntp: prefix FD on every log line Date: Fri, 25 Sep 2015 02:27:54 +0000 Message-Id: <20150925022757.6915-6-e@80x24.org> In-Reply-To: <20150925022757.6915-1-e@80x24.org> References: <20150925022757.6915-1-e@80x24.org> List-Id: This can help us track down what request patterns clients will perform when we have multiple clients. --- lib/PublicInbox/NNTP.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 7e2c2ab..3490a09 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -492,11 +492,12 @@ sub long_response ($$$$) { my ($self, $beg, $end, $cb) = @_; die "BUG: nested long response" if $self->{long_res}; + my $fd = $self->{fd}; + defined $fd or return; # make sure we disable reading during a long response, # clients should not be sending us stuff and making us do more # work while we are stream a response to them $self->watch_read(0); - my $fd = fileno $self->{sock}; my $t0 = now(); $self->{long_res} = sub { # limit our own running time for fairness with other @@ -885,10 +886,11 @@ sub event_read { while ($r > 0 && $self->{rbuf} =~ s/\A\s*([^\r\n]+)\r?\n//) { my $line = $1; my $t0 = now(); + my $fd = $self->{fd}; $r = eval { $self->process_line($line) }; my $d = $self->{long_res} ? - ' deferred['.fileno($self->{sock}).']' : ''; - out($self, "$line - %0.6f$d", now() - $t0); + " deferred[$fd]" : ''; + out($self, "[$fd] $line - %0.6f$d", now() - $t0); } return $self->close if $r < 0; -- EW