From: Eric Wong Date: Sat, 9 Jul 2016 04:51:36 +0000 (+0000) Subject: httpd/async: do not attempt future writes on closed sockets X-Git-Tag: v1.0.0~282 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=acd3a41f52167b8e41cf34ab8164a9dfb5ef9c5c;p=public-inbox.git httpd/async: do not attempt future writes on closed sockets Danga::Socket::close does not clear the write_buf_size field, so it's conceivable we could attempt to queue up data and callbacks we can never flush out. --- diff --git a/lib/PublicInbox/HTTPD/Async.pm b/lib/PublicInbox/HTTPD/Async.pm index a936d9b5..880cf021 100644 --- a/lib/PublicInbox/HTTPD/Async.pm +++ b/lib/PublicInbox/HTTPD/Async.pm @@ -41,6 +41,7 @@ sub async_pass { my $r = sysread($self->{sock}, $$bref, 8192); if ($r) { $fh->write($$bref); + return if $io->{closed}; if ($io->{write_buf_size}) { $self->watch_read(0); $io->write($restart_read); # D::S::write