The restart_read callback has no chance of circular reference,
and weakening $self before we create it can cause $self to
be undefined inside the callback (seen during stress testing).
Fixes: 395406118cb2 ("httpd/async: prevent circular reference")
$self;
}
+sub restart_read_cb ($) {
+ my ($self) = @_;
+ sub { $self->watch_read(1) }
+}
+
sub async_pass {
my ($self, $io, $fh, $bref) = @_;
# In case the client HTTP connection ($io) dies, it
# will automatically close this ($self) object.
$io->{forward} = $self;
$fh->write($$bref);
+ my $restart_read = restart_read_cb($self);
weaken($self);
- my $restart_read = sub { $self->watch_read(1) };
$self->{cb} = sub {
my $r = sysread($self->{sock}, $$bref, 8192);
if ($r) {