Skip to content

Commit

Permalink
[client] Enable network map persistence by default (#3152)
Browse files Browse the repository at this point in the history
  • Loading branch information
lixmal authored Jan 6, 2025
1 parent 02a3fed commit f08605a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions client/internal/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion client/internal/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 2 additions & 0 deletions client/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func New(ctx context.Context, configPath, logFile string) *Server {
signalProbe: internal.NewProbe(),
relayProbe: internal.NewProbe(),
wgProbe: internal.NewProbe(),

persistNetworkMap: true,
}
}

Expand Down

0 comments on commit f08605a

Please sign in to comment.