mirror of
https://github.com/tailscale/tailscale.git
synced 2026-10-02 08:24:45 -04:00
Each connected client held two buffered channels of 32 pkts each (its regular and disco send queues), about 5.5 KB per client for the lifetime of the connection, even though almost all clients are idle at any given moment. Replace the channels with pktQueue, a mutex-guarded ring buffer whose backing array comes from a per-server sync.Pool on first enqueue and goes back when the queue drains empty, so an idle client holds no queue memory at all. Enqueuers wake the client's sendLoop through a one-slot channel. Updates #21064 Change-Id: I2d7e8f4a1b6c3950e2a7d4b8f1c5e3a9d6b0c2e4 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>