From: Omar Polo Subject: Re: make 'got send' detect closed connections To: Stefan Sperling Cc: gameoftrees@openbsd.org Date: Thu, 14 Sep 2023 17:59:41 +0200 On 2023/09/14 09:54:54 +0200, Stefan Sperling wrote: > On Wed, Sep 13, 2023 at 10:19:13PM +0200, Stefan Sperling wrote: > > Here is a working diff using SIGCHLD. > > Well, not quite. I am seeing spurious disconnects when sending to > Github while running with this patch... > > Maybe the signal-based approach is just too inherently racy to > easily get right. Should we go for polling after all? I think so too. I don't think it's a great idea for code in lib/ to start messing with signals. SIGWINCH could be an exception since ncurses usually sets it, but for other signals... meh :/ so, if you really want to check for this specific case, the polling is not bad. the progress callback is delayed. One minor optimization of your original diff could be do to not poll() when we're writing the packfile, a connection closed there results in a write() failure.