mirror of
https://github.com/netbirdio/netbird.git
synced 2025-01-08 23:19:09 +01:00
[client] Enable network map persistence by default (#3152)
This commit is contained in:
parent
02a3feddb8
commit
f08605a7f1
@ -382,8 +382,7 @@ func (c *ConnectClient) isContextCancelled() bool {
|
|||||||
// SetNetworkMapPersistence enables or disables network map persistence.
|
// SetNetworkMapPersistence enables or disables network map persistence.
|
||||||
// When enabled, the last received network map will be stored and can be retrieved
|
// When enabled, the last received network map will be stored and can be retrieved
|
||||||
// through the Engine's getLatestNetworkMap method. When disabled, any stored
|
// through the Engine's getLatestNetworkMap method. When disabled, any stored
|
||||||
// network map will be cleared. This functionality is primarily used for debugging
|
// network map will be cleared.
|
||||||
// and should not be enabled during normal operation.
|
|
||||||
func (c *ConnectClient) SetNetworkMapPersistence(enabled bool) {
|
func (c *ConnectClient) SetNetworkMapPersistence(enabled bool) {
|
||||||
c.engineMutex.Lock()
|
c.engineMutex.Lock()
|
||||||
c.persistNetworkMap = enabled
|
c.persistNetworkMap = enabled
|
||||||
|
@ -1597,7 +1597,7 @@ func (e *Engine) GetLatestNetworkMap() (*mgmProto.NetworkMap, error) {
|
|||||||
return nil, nil
|
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)
|
nm, ok := proto.Clone(e.latestNetworkMap).(*mgmProto.NetworkMap)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
||||||
|
@ -91,6 +91,8 @@ func New(ctx context.Context, configPath, logFile string) *Server {
|
|||||||
signalProbe: internal.NewProbe(),
|
signalProbe: internal.NewProbe(),
|
||||||
relayProbe: internal.NewProbe(),
|
relayProbe: internal.NewProbe(),
|
||||||
wgProbe: internal.NewProbe(),
|
wgProbe: internal.NewProbe(),
|
||||||
|
|
||||||
|
persistNetworkMap: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user