diff options
| author | Claus Lensbøl <claus@tailscale.com> | 2026-03-24 14:19:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-24 14:19:21 -0400 |
| commit | 87ec3235d96df92b45c1cd9aee5c63be7ea67a7f (patch) | |
| tree | 1eaa330ea9746dff1cdaee72a369783ac272c477 | |
| parent | 590546b17db751ac8b0b06dbbe0bede9edb3993e (diff) | |
| download | tailscale-87ec3235d96df92b45c1cd9aee5c63be7ea67a7f.tar.xz tailscale-87ec3235d96df92b45c1cd9aee5c63be7ea67a7f.zip | |
control/controlclient: allow multiple non-streaming map requests (#19106)
A client with an active streaming session would break if using the same
client for a non-streaming session. Allow the client 1 streaming and n
non-streaming sessions at the same time.
Fixes #19105
Signed-off-by: Claus Lensbøl <claus@tailscale.com>
| -rw-r--r-- | control/controlclient/direct.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index 593aa463d..46f759fc6 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -1121,18 +1121,22 @@ func (c *Direct) sendMapRequest(ctx context.Context, isStreaming bool, nu Netmap return nil } - if c.streamingMapSession != nil { + if isStreaming && c.streamingMapSession != nil { panic("mapSession is already set") } sess := newMapSession(persist.PrivateNodeKey(), nu, c.controlKnobs) - c.streamingMapSession = sess - defer func() { - sess.Close() - c.mu.Lock() - c.streamingMapSession = nil - c.mu.Unlock() - }() + if isStreaming { + c.streamingMapSession = sess + defer func() { + sess.Close() + c.mu.Lock() + c.streamingMapSession = nil + c.mu.Unlock() + }() + } else { + defer sess.Close() + } sess.cancel = cancel sess.logf = c.logf sess.vlogf = vlogf |
