user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 5/7] nntp: avoid infinite loop on partial read
  2015-09-24  3:37  5% [PATCH 0/7] another round of NNTP updates Eric Wong
@ 2015-09-24  3:37  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2015-09-24  3:37 UTC (permalink / raw)
  To: meta

Oops :x
---
 lib/PublicInbox/NNTP.pm | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 52d6a64..6c661a1 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -879,22 +879,18 @@ sub event_write {
 sub event_read {
 	my ($self) = @_;
 	use constant LINE_MAX => 512; # RFC 977 section 2.3
-	my $line;
 	my $r = 1;
-again:
+
+	my $buf = $self->read(LINE_MAX) or return $self->close;
+	$self->{rbuf} .= $$buf;
 	while ($r > 0 && $self->{rbuf} =~ s/\A\s*([^\r\n]+)\r?\n//) {
-		$line = $1;
+		my $line = $1;
 		my $t0 = now();
 		$r = eval { $self->process_line($line) };
 		my $d = $self->{long_res} ?
 			' deferred['.fileno($self->{sock}).']' : '';
 		out($self, "$line - %0.6f$d", now() - $t0);
 	}
-	unless (defined $line) {
-		my $buf = $self->read(LINE_MAX) or return $self->close;
-		$self->{rbuf} .= $$buf;
-		goto again;
-	}
 
 	return $self->close if $r < 0;
 	my $len = length($self->{rbuf});
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/7] another round of NNTP updates
@ 2015-09-24  3:37  5% Eric Wong
  2015-09-24  3:37  7% ` [PATCH 5/7] nntp: avoid infinite loop on partial read Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2015-09-24  3:37 UTC (permalink / raw)
  To: meta

We'll still need better tests, but most of this seems to
work alright.  Must. Fix. XOVER. Performance. Next!

Eric Wong (7):
      nntp: fix XOVER command
      nntpd: additional daemonization options
      nntpd: hard quit after 30s
      nntpd: move busy check to NNTP package
      nntp: avoid infinite loop on partial read
      nntpd: better encapsulation for shutdown
      nntpd: support SIGUSR2 in single-process mode, too

 lib/PublicInbox/NNTP.pm |  21 +++++----
 public-inbox-nntpd      | 118 +++++++++++++++++++++++++++++++++++++++++++-----
 t/nntpd.t               |   9 +++-
 3 files changed, 126 insertions(+), 22 deletions(-)


^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-09-24  3:37  5% [PATCH 0/7] another round of NNTP updates Eric Wong
2015-09-24  3:37  7% ` [PATCH 5/7] nntp: avoid infinite loop on partial read Eric Wong

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).