From f08605a7f16a69d5d26aa7462b63868e40ec1541 Mon Sep 17 00:00:00 2001 From: Viktor Liu <17948409+lixmal@users.noreply.github.com> Date: Mon, 6 Jan 2025 14:11:43 +0100 Subject: [PATCH] [client] Enable network map persistence by default (#3152) --- client/internal/connect.go | 3 +-- client/internal/engine.go | 2 +- client/server/server.go | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/internal/connect.go b/client/internal/connect.go index 782984e27..5cbf54f75 100644 --- a/client/internal/connect.go +++ b/client/internal/connect.go @@ -382,8 +382,7 @@ func (c *ConnectClient) isContextCancelled() bool { // SetNetworkMapPersistence enables or disables network map persistence. // When enabled, the last received network map will be stored and can be retrieved // through the Engine's getLatestNetworkMap method. When disabled, any stored -// network map will be cleared. This functionality is primarily used for debugging -// and should not be enabled during normal operation. +// network map will be cleared. func (c *ConnectClient) SetNetworkMapPersistence(enabled bool) { c.engineMutex.Lock() c.persistNetworkMap = enabled diff --git a/client/internal/engine.go b/client/internal/engine.go index 896104df8..86f3332a8 100644 --- a/client/internal/engine.go +++ b/client/internal/engine.go @@ -1597,7 +1597,7 @@ func (e *Engine) GetLatestNetworkMap() (*mgmProto.NetworkMap, error) { return nil, nil } - // Create a deep copy to avoid external modifications + log.Debugf("Retrieving latest network map with size %d bytes", proto.Size(e.latestNetworkMap)) nm, ok := proto.Clone(e.latestNetworkMap).(*mgmProto.NetworkMap) if !ok { diff --git a/client/server/server.go b/client/server/server.go index 5640ffa39..cba5a1148 100644 --- a/client/server/server.go +++ b/client/server/server.go @@ -91,6 +91,8 @@ func New(ctx context.Context, configPath, logFile string) *Server { signalProbe: internal.NewProbe(), relayProbe: internal.NewProbe(), wgProbe: internal.NewProbe(), + + persistNetworkMap: true, } }