Skip to content

r48: make yamux accept errors fatal so we reconnect

Choose a tag to compare

@github-actions github-actions released this 21 Sep 04:26
· 2 commits to main since this release
A yamux session hands back the error that killed it from Accept. When the
connection to Caddy stops answering reads, that error is a TCP timeout,
which net.Error calls temporary, so http.Server treated it as a transient
accept failure and retried forever ("http: Accept error: ...; retrying in
1s") instead of returning. DialAndServe never returned, so the backoff in
cmd/clientproxy never re-dialed and only a restart recovered.

Wrap the session in a listener that drops the net.Error behavior of accept
errors (still unwrapping for errors.Is), so Serve returns and the caller
reconnects. Also stop the context AfterFunc once serve ends.