mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-20 21:59:07 +02:00
[client] Apply lazy connection toggle to running engine
The daemon SetConfig only persisted the lazy connection flag to the profile config; the running engine was untouched, so a UI/CLI change took effect only after a down/up or daemon restart. Wire SetConfig to push the change into the running engine via a new ConnMgr.SetLocalLazyConn, which sets enabledLocally like an env/CLI flag so a later management sync cannot override it, and starts or stops the lazy manager in place.
This commit is contained in:
@@ -422,6 +422,16 @@ func (s *Server) SetConfig(callerCtx context.Context, msg *proto.SetConfigReques
|
||||
return nil, fmt.Errorf("failed to update profile config: %w", err)
|
||||
}
|
||||
|
||||
// Apply the lazy connection toggle to the running engine so it takes
|
||||
// effect without a down/up. s.mutex is already held.
|
||||
if msg.LazyConnectionEnabled != nil && s.connectClient != nil {
|
||||
if engine := s.connectClient.Engine(); engine != nil {
|
||||
if err := engine.SetLazyConnEnabled(msg.GetLazyConnectionEnabled()); err != nil {
|
||||
log.Errorf("failed to apply lazy connection change at runtime: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &proto.SetConfigResponse{}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user