Fail loudly on a touch read, stop the workers before their sockets close, and file down the small edges

This commit is contained in:
flamingcow
2026-08-04 22:26:07 -07:00
parent 12cef6a89b
commit 7b2601a02e
5 changed files with 38 additions and 20 deletions
+5 -2
View File
@@ -170,10 +170,13 @@ func (p *probeSender) awaitTx(scratch, oob []byte) (int64, bool) {
fds := []unix.PollFd{{Fd: int32(p.fd), Events: unix.POLLERR}}
deadline := time.Now().Add(probeTimeout)
for {
ms := int(time.Until(deadline).Milliseconds())
if ms <= 0 {
left := time.Until(deadline)
if left <= 0 {
return 0, false
}
// Rounded up, since truncating would give up with time still on the
// clock and shave the last fraction of a millisecond off every wait.
ms := int((left + time.Millisecond - 1) / time.Millisecond)
n, err := unix.Poll(fds, ms)
if err == unix.EINTR {
continue