Files
gerbil/relay
Aditya kumar singh 72d737ef4d fix: prevent panic on double Stop() of UDPProxyServer (#51)
The UDPProxyServer.Stop() method was being called twice on every clean
shutdown — once via defer proxyRelay.Stop() in main() and once from
the shutdown errgroup goroutine — causing a 'close of closed channel'
panic.

The old guard using a bare select on s.ctx.Done() was ineffective: by
the second call the context was already cancelled, so both code paths
fell through unconditionally to close(s.packetChan), panicking.

Fix: wrap the entire Stop() body in a sync.Once so that all cleanup
(cancel, conn close, packetChan close) runs at most once regardless of
how many times or from how many goroutines Stop() is called.

Fixes #51
2026-07-21 17:47:03 +05:30
..