From 87ec3235d96df92b45c1cd9aee5c63be7ea67a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20Lensb=C3=B8l?= Date: Tue, 24 Mar 2026 14:19:21 -0400 Subject: [PATCH] control/controlclient: allow multiple non-streaming map requests (#19106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- control/controlclient/direct.go | 20 ++++++++++++-------- 1 file 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