X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FGzipFilter.pm;h=48ed11a5d55cb782c9161a5589e798d63d3a8498;hb=af0b0fb7a454470a32c452119d0392e0dedb3fe1;hp=f1354d2b7eb4e015a54aca61c129df1c70838ab4;hpb=3a825edc7e2ad557b50a10780dc4118902d2635e;p=public-inbox.git
diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm
index f1354d2b..48ed11a5 100644
--- a/lib/PublicInbox/GzipFilter.pm
+++ b/lib/PublicInbox/GzipFilter.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2020 all contributors
+# Copyright (C) 2020-2021 all contributors
# License: AGPL-3.0+
#
# In public-inbox <=1.5.0, public-inbox-httpd favored "getline"
@@ -7,8 +7,8 @@
#
# In newer versions, public-inbox-httpd supports a backpressure-aware
# pull/push model which also accounts for slow git blob storage.
-# {async_next} callbacks only run when the DS {wbuf} is drained
-# {async_eml} callbacks only run when a blob arrives from git.
+# async_next callbacks only run when the DS {wbuf} is drained
+# async_eml callbacks only run when a blob arrives from git.
#
# We continue to support getline+close for generic PSGI servers.
package PublicInbox::GzipFilter;
@@ -46,18 +46,16 @@ sub gz_or_noop {
sub gzf_maybe ($$) { bless { gz => gz_or_noop(@_) }, __PACKAGE__ }
sub psgi_response {
- my ($self, $code, $res_hdr, $next_cb, $eml_cb) = @_;
+ my ($self, $code, $res_hdr) = @_;
my $env = $self->{env};
$self->{gz} //= gz_or_noop($res_hdr, $env);
if ($env->{'pi-httpd.async'}) {
- $self->{async_next} = $next_cb;
- $self->{async_eml} = $eml_cb;
my $http = $env->{'psgix.io'}; # PublicInbox::HTTP
$http->{forward} = $self;
sub {
my ($wcb) = @_; # -httpd provided write callback
$self->{http_out} = $wcb->([$code, $res_hdr]);
- $next_cb->($http); # start stepping
+ $self->can('async_next')->($http); # start stepping
};
} else { # generic PSGI code path
[ $code, $res_hdr, $self ];
@@ -171,18 +169,18 @@ sub async_blob_cb { # git->cat_async callback
if (!defined($oid)) {
# it's possible to have TOCTOU if an admin runs
# public-inbox-(edit|purge), just move onto the next message
- warn "E: $smsg->{blob} missing in $self->{-inbox}->{inboxdir}\n";
- return $http->next_step($self->{async_next});
+ warn "E: $smsg->{blob} missing in $self->{ibx}->{inboxdir}\n";
+ return $http->next_step($self->can('async_next'));
}
$smsg->{blob} eq $oid or bail($self, "BUG: $smsg->{blob} != $oid");
- eval { $self->{async_eml}->($self, PublicInbox::Eml->new($bref)) };
+ eval { $self->async_eml(PublicInbox::Eml->new($bref)) };
bail($self, "E: async_eml: $@") if $@;
- $http->next_step($self->{async_next});
+ $http->next_step($self->can('async_next'));
}
sub smsg_blob {
my ($self, $smsg) = @_;
- git_async_cat($self->{-inbox}->git, $smsg->{blob},
+ git_async_cat($self->{ibx}->git, $smsg->{blob},
\&async_blob_cb, $self);
}