(delete($self->{http_out}) // return)->close;
}
-sub bail {
+sub bail {
my $self = shift;
carp @_;
my $env = $self->{env} or return;
my ($bref, $oid, $type, $size, $self) = @_;
my $http = $self->{env}->{'psgix.io'}; # PublicInbox::HTTP
$http->{forward} or return; # client aborted
- my $smsg = $self->{smsg} or bail($self, 'BUG: no smsg');
- if (!defined($oid)) {
+ my $smsg = $self->{smsg} or return bail($self, 'BUG: no smsg');
+ $type // return
+ bail($self, "abort: $smsg->{blob} $self->{ibx}->{inboxdir}");
+ if ($type ne 'blob') {
# 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->{ibx}->{inboxdir}\n";
+ warn "E: $smsg->{blob} $type in $self->{ibx}->{inboxdir}\n";
return $http->next_step($self->can('async_next'));
}
- $smsg->{blob} eq $oid or bail($self, "BUG: $smsg->{blob} != $oid");
+ $smsg->{blob} eq $oid or return
+ bail($self, "BUG: $smsg->{blob} != $oid");
eval { $self->async_eml(PublicInbox::Eml->new($bref)) };
- bail($self, "E: async_eml: $@") if $@;
+ return bail($self, "E: async_eml: $@") if $@;
if ($self->{-low_prio}) { # run via PublicInbox::WWW::event_step
push(@{$self->{www}->{-low_prio_q}}, $self) == 1 and
PublicInbox::DS::requeue($self->{www});
my ($self, undef, $msgs, $range_info, $ops, $partial) = @$fetch_arg;
my $ibx = $self->{ibx} or return $self->close; # client disconnected
my $smsg = shift @$msgs or die 'BUG: no smsg';
- if (!defined($oid)) {
+ if (!defined($type)) {
+ warn "E: git aborted on $oid / $smsg->{blob} $ibx->{inboxdir}";
+ return $self->close;
+ } elsif ($type ne 'blob') {
# 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 $ibx->{inboxdir}\n";
+ warn "E: $smsg->{blob} $type in $ibx->{inboxdir}\n";
return $self->requeue_once;
- } else {
- $smsg->{blob} eq $oid or die "BUG: $smsg->{blob} != $oid";
}
+ $smsg->{blob} eq $oid or die "BUG: $smsg->{blob} != $oid";
my $pre;
($self->{anon} && !$self->{wbuf} && $msgs->[0]) and
$pre = ibx_async_prefetch($ibx, $msgs->[0]->{blob},
my ($bref, $oid, $type, $size, $smsg) = @_;
my $self = $smsg->{nntp};
my $code = $smsg->{nntp_code};
- if (!defined($oid)) {
+ if (!defined($type)) {
+ warn "E: git aborted on $oid / $smsg->{blob} ".
+ $self->{-ibx}->{inboxdir};
+ return $self->close;
+ } elsif ($type ne 'blob') {
# 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 $smsg->{-ibx}->{inboxdir}\n";
my ($self, $off, $top_nr) = @$args;
my $hex = $self->{cache}->[$off * 3 + 2] //
die "BUG: no hex (oid=$oid)";
- if (!defined($oid)) {
+ if (!defined($type)) {
+ warn "E: git aborted on $oid / $hex $self->{ibx}->{inboxdir}";
+ return $self->close;
+ } elsif ($type ne 'blob') {
# it's possible to have TOCTOU if an admin runs
# public-inbox-(edit|purge), just move onto the next message
warn "E: $hex missing in $self->{ibx}->{inboxdir}\n";