]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
ds: flush_write: check {sock} after calling CODE
authorEric Wong <e@80x24.org>
Mon, 23 Jun 2025 18:51:36 +0000 (18:51 +0000)
committerEric Wong <e@80x24.org>
Tue, 24 Jun 2025 17:34:54 +0000 (17:34 +0000)
A user callback may call ->close and invalidate {sock} or even
replace it, so we must revalidate the {sock} field and break
break out of the loop ASAP to ensure we don't attempt further
operations on an invalid socket.

This really ought to fix the
`BUG: ep_mod GLOB=GLOB(...): no such file or directory' (ENOENT)
errors on EPOLL_CTL_MOD when a client shuts down TLS on us.

Followup-to: f7aaea70 (ds: shutdn_tls_step clobbers {wbuf} early, 2025-06-17)
lib/PublicInbox/DS.pm

index 901e762b96f2475ac0b06e2bcb612bb86306b54b..f3fdd1d5517cab44dbcfbdf33eb1dba103ec7b43 100644 (file)
@@ -429,6 +429,7 @@ next_buf:
                        # bref may be enqueueing more CODE to call
                        # (see accept_tls_step)
                        return 0 if (scalar(@$wbuf) > $before);
+                       $sock = $self->{sock} // return;
                }
        } # while @$wbuf