mirror of
https://github.com/juanfont/headscale.git
synced 2026-03-17 19:53:57 +09:00
Rewrite multiChannelNodeConn.send() to use a two-phase approach: 1. RLock: snapshot connections slice (cheap pointer copy) 2. Unlock: send to all connections (50ms timeouts happen here) 3. Lock: remove failed connections by pointer identity Previously, send() held the write lock for the entire duration of sending to all connections. With N stale connections each timing out at 50ms, this blocked addConnection/removeConnection for N*50ms. The two-phase approach holds the lock only for O(N) pointer operations, not for N*50ms I/O waits.