From acd3a41f52167b8e41cf34ab8164a9dfb5ef9c5c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 9 Jul 2016 04:51:36 +0000 Subject: 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. --- lib/PublicInbox/HTTPD/Async.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/PublicInbox/HTTPD') 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 -- cgit v1.2.3-24-ge0c7