about summary refs log tree commit homepage
path: root/lib/PublicInbox/DS.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-24 02:52:49 +0000
committerEric Wong <e@80x24.org>2019-06-24 05:26:27 +0000
commit3667c96f84a39c8fbfaf4cef37f58a9db06bb4b3 (patch)
treec7c31ec5d53a1abcc8930fcb4d556b21c0bd91f7 /lib/PublicInbox/DS.pm
parent3ac6b68138da02cea825f22468d9850c67c15916 (diff)
downloadpublic-inbox-3667c96f84a39c8fbfaf4cef37f58a9db06bb4b3.tar.gz
ds: flush_write runs ->write callbacks even if closed
We may need to rely on cleanup code running in enqueued
callbacks, so ensure we call it when flush_write happens.
Diffstat (limited to 'lib/PublicInbox/DS.pm')
-rw-r--r--lib/PublicInbox/DS.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index 8f77ce24..d38e2d20 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -442,13 +442,13 @@ sub psendfile ($$$) {
 sub flush_write ($) {
     my ($self) = @_;
     my $wbuf = $self->{wbuf} or return 1;
-    my $sock = $self->{sock} or return 1;
+    my $sock = $self->{sock};
 
 next_buf:
     while (my $bref = $wbuf->[0]) {
         if (ref($bref) ne 'CODE') {
             my $off = delete($self->{wbuf_off}) // 0;
-            while (1) {
+            while ($sock) {
                 my $w = psendfile($sock, $bref, \$off);
                 if (defined $w) {
                     if ($w == 0) {