]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git: ensure ->destroy clobbers check_async read buffer
authorEric Wong <e@80x24.org>
Fri, 16 Oct 2020 06:59:32 +0000 (06:59 +0000)
committerEric Wong <e@80x24.org>
Fri, 16 Oct 2020 17:15:23 +0000 (17:15 +0000)
It's currently not a problem as ->destroy doesn't
happen for no reason, we'll need to ensure future uses of
->destroy correctly discard the check_async buffer.

lib/PublicInbox/Git.pm

index 2323cecc49f1affe6571820e2653802aa1273a41..449223eca626e7c37d6de72676803a694061da0f 100644 (file)
@@ -239,7 +239,7 @@ sub check_async_step ($$) {
        my ($self, $inflight_c) = @_;
        die 'BUG: inflight empty or odd' if scalar(@$inflight_c) < 3;
        my ($req, $cb, $arg) = splice(@$inflight_c, 0, 3);
-       my $rbuf = delete($self->{rbuf_c}) // \(my $new = '');
+       my $rbuf = delete($self->{chk_rbuf}) // \(my $new = '');
        chomp(my $line = my_readline($self->{in_c}, $rbuf));
        my ($hex, $type, $size) = split(/ /, $line);
 
@@ -253,7 +253,7 @@ sub check_async_step ($$) {
        }
        eval { $cb->($hex, $type, $size, $arg, $self) };
        warn "E: check($req) $@\n" if $@;
-       $self->{rbuf_c} = $rbuf if $$rbuf ne '';
+       $self->{chk_rbuf} = $rbuf if $$rbuf ne '';
 }
 
 sub check_async_wait ($) {