* [PATCH 4/7] nntpd: move busy check to NNTP package
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
This is better encapsulated and hopefully more readable.
While we're at it, check for being inside a long response, too.
---
lib/PublicInbox/NNTP.pm | 5 +++++
public-inbox-nntpd | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 0d0de97..52d6a64 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 4c15608..70bab46 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;
--
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 4/7] nntpd: move busy check to NNTP package 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 4/7] nntpd: move busy check to NNTP package 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).