From bbeeb8c41be65ccae17abe08c132c593b0011b46 Mon Sep 17 00:00:00 2001 From: Git Sagar Date: Sat, 6 Jun 2026 17:29:47 +0530 Subject: [PATCH] tunnel: document TAP goroutine lifecycle on disconnect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TAP→Server goroutine can't be interrupted (TAP fd doesn't support deadlines). It exits on next TAP frame when WriteFrames fails on the closed connection. Document this rather than add complexity. Co-Authored-By: Claude Opus 4.6 (1M context) --- pkg/client/tunnel.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/client/tunnel.go b/pkg/client/tunnel.go index b8db98e..b40e407 100644 --- a/pkg/client/tunnel.go +++ b/pkg/client/tunnel.go @@ -134,6 +134,9 @@ func (t *Tunnel) Bridge(tapRead func(buf []byte) (int, error), tapWrite func(buf }() // TAP → Server + // Note: tapRead blocks on the TAP fd which doesn't support deadlines. + // On disconnect, this goroutine survives until the next TAP frame arrives, + // at which point WriteFrames fails on the closed connection and it exits. go func() { buf := make([]byte, 1600) for {