user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
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	[thread overview]
Message-ID: <20150925022757.6915-6-e@80x24.org> (raw)
In-Reply-To: <20150925022757.6915-1-e@80x24.org>

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


  parent reply	other threads:[~2015-09-25  2:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25  2:27 [PATCH 0/8] nntp: more fixes and tiny speedups Eric Wong
2015-09-25  2:27 ` [PATCH 1/8] nntp: HDR allows metadata prefixed with ':' Eric Wong
2015-09-25  2:27 ` [PATCH 2/8] nntp: consistently use 501 for unsupported LIST Eric Wong
2015-09-25  2:27 ` [PATCH 3/8] searchidx: remove unused sub: next_doc_id Eric Wong
2015-09-25  2:27 ` [PATCH 4/8] nntp: do not repeat result on blocked write Eric Wong
2015-09-25  2:27 ` Eric Wong [this message]
2015-09-25  2:27 ` [PATCH 6/8] git: signal-safety for pipe writes Eric Wong
2015-09-25  2:27 ` [PATCH 7/8] git: use fields for GitCatFile Eric Wong
2015-09-25  2:27 ` [PATCH 8/8] nntp: avoid signals for long responses Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150925022757.6915-6-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).