From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/4] ds: use ->dflush to distinguish from ->zflush
Date: Wed, 3 Aug 2022 07:59:11 +0000 [thread overview]
Message-ID: <20220803075912.10219-4-e@80x24.org> (raw)
In-Reply-To: <20220803075912.10219-1-e@80x24.org>
->zflush is already for GzipFilter in PublicInbox::WWW,
while we use DEFLATE for NNTP and IMAP. This ought to
make the code easier-to-follow.
---
lib/PublicInbox/DS.pm | 4 ++--
lib/PublicInbox/DSdeflate.pm | 4 ++--
lib/PublicInbox/IMAP.pm | 2 +-
lib/PublicInbox/NNTP.pm | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index ef483aac..77e2e5e9 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -648,7 +648,7 @@ sub shutdn ($) {
}
}
-sub zflush {} # overridden by DSdeflate
+sub dflush {} # overridden by DSdeflate
sub compressed {} # overridden by DSdeflate
sub long_response_done {} # overridden by Net::NNTP
@@ -682,7 +682,7 @@ sub requeue_once {
my ($self) = @_;
# COMPRESS users all share the same DEFLATE context.
# Flush it here to ensure clients don't see each other's data
- $self->zflush;
+ $self->dflush;
# no recursion, schedule another call ASAP,
# but only after all pending writes are done.
diff --git a/lib/PublicInbox/DSdeflate.pm b/lib/PublicInbox/DSdeflate.pm
index bf0ecd38..639690e2 100644
--- a/lib/PublicInbox/DSdeflate.pm
+++ b/lib/PublicInbox/DSdeflate.pm
@@ -30,7 +30,7 @@ my %IN_OPT = (
my ($zout, $zbuf);
{
my $err;
- $zbuf = \(my $initial = ''); # replaced by $next in zflush/write
+ $zbuf = \(my $initial = ''); # replaced by $next in dflush/write
($zout, $err) = Compress::Raw::Zlib::Deflate->new(
# nnrpd (INN) and Compress::Raw::Zlib favor MemLevel=9,
# the zlib C library and git use MemLevel=8 as the default
@@ -100,7 +100,7 @@ sub msg_more ($$) {
1;
}
-sub zflush ($) {
+sub dflush ($) {
my ($self) = @_;
my $deflated = $zbuf;
diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm
index 805f1102..0f0f9b3a 100644
--- a/lib/PublicInbox/IMAP.pm
+++ b/lib/PublicInbox/IMAP.pm
@@ -595,7 +595,7 @@ sub fetch_blob_cb { # called by git->cat_async via ibx_async_cat
\&fetch_blob_cb, $fetch_arg);
}
fetch_run_ops($self, $smsg, $bref, $ops, $partial);
- $pre ? $self->zflush : $self->requeue_once;
+ $pre ? $self->dflush : $self->requeue_once;
}
sub emit_rfc822 {
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index b223eb07..791fe2a9 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -556,7 +556,7 @@ sub blob_cb { # called by git->cat_async via ibx_async_cat
$self->close;
die "BUG: bad code: $r";
}
- $self->write(\".\r\n"); # flushes (includes ->zflush)
+ $self->write(\".\r\n"); # flushes (includes ->dflush)
$self->requeue;
}
next prev parent reply other threads:[~2022-08-03 7:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-03 7:59 [PATCH 0/4] compression-related stuff Eric Wong
2022-08-03 7:59 ` [PATCH 1/4] www: gzip_filter: gracefully handle socket ->write failures Eric Wong
2022-08-03 7:59 ` [PATCH 2/4] www: gzip_filter: update a few comments Eric Wong
2022-08-03 7:59 ` Eric Wong [this message]
2022-08-03 7:59 ` [PATCH 4/4] www: simplify GzipFilter->zflush callers 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=20220803075912.10219-4-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.
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).