diff options
author | Eric Wong <e@80x24.org> | 2015-09-24 03:37:18 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-09-24 06:58:31 +0000 |
commit | 812b9991ac21cbba7d9e60cb5a9e06a9fb69351d (patch) | |
tree | 018f5f6800c56689aed245eaff86c5ea9b3c30fb | |
parent | 5e3247dc8d3844f2771dba6b5d316089f49ff40e (diff) | |
download | public-inbox-812b9991ac21cbba7d9e60cb5a9e06a9fb69351d.tar.gz |
This is better encapsulated and hopefully more readable. While we're at it, check for being inside a long response, too.
-rw-r--r-- | lib/PublicInbox/NNTP.pm | 5 | ||||
-rw-r--r-- | public-inbox-nntpd | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 0d0de976..52d6a64c 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -919,4 +919,9 @@ sub watch_read { $rv; } +sub busy () { + my ($self) = @_; + ($self->{rbuf} ne '' || $self->{long_res} || $self->{write_buf_size}); +} + 1; diff --git a/public-inbox-nntpd b/public-inbox-nntpd index 4c156080..70bab46f 100644 --- a/public-inbox-nntpd +++ b/public-inbox-nntpd @@ -205,7 +205,7 @@ sub worker_quit { foreach my $s (values %$dmap) { next unless ref($s) eq 'PublicInbox::NNTP'; - if ($s->{write_buf_size} || $s->{rbuf}) { + if ($s->busy) { ++$n; } else { $s->close; |