Files
netbird/client/internal/engine_lazyconn.go
T
Zoltán Papp 6881c0f985 [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.
2026-06-17 16:51:01 +02:00

20 lines
524 B
Go

package internal
import (
"errors"
)
// SetLazyConnEnabled applies a local lazy connection override to the running
// engine. It pins the setting like an env/CLI flag, so a later management sync
// cannot override it. syncMsgMux guards ConnMgr, which is not thread-safe.
func (e *Engine) SetLazyConnEnabled(enabled bool) error {
e.syncMsgMux.Lock()
defer e.syncMsgMux.Unlock()
if e.connMgr == nil {
return errors.New("connection manager is not initialised")
}
return e.connMgr.SetLocalLazyConn(e.ctx, enabled)
}