[client] tie DNS warm-up dial to engine context; fix codespell

This commit is contained in:
mlsmaycon
2026-07-15 22:17:57 +02:00
parent 82d8f0a4ee
commit 38b377f21e
3 changed files with 11 additions and 4 deletions
+9 -3
View File
@@ -20,11 +20,17 @@ type dnsPeerActivator struct {
peerStore *peerstore.Store peerStore *peerstore.Store
status *peer.Status status *peer.Status
mu *sync.Mutex mu *sync.Mutex
// ctx is the engine's long-lived context. The connection dial is tied to it
// (not the per-query DNS wait budget) so a handshake that outlasts the wait
// still completes in the background rather than being cancelled at the deadline.
ctx context.Context
} }
// ActivatePeersByIP triggers wake-up for the peer(s) owning ips and waits until // ActivatePeersByIP triggers wake-up for the peer(s) owning ips and waits until
// one is connected or ctx expires. Unknown or already-connected IPs are skipped, // one is connected or ctx (the per-query DNS wait budget) expires. Activation
// so the steady-state (warm) path adds no latency. // itself is tied to the engine's long-lived context so the dial survives a wait
// that times out. Unknown or already-connected IPs are skipped, so the
// steady-state (warm) path adds no latency.
func (a *dnsPeerActivator) ActivatePeersByIP(ctx context.Context, ips []string) { func (a *dnsPeerActivator) ActivatePeersByIP(ctx context.Context, ips []string) {
if a == nil || a.connMgr == nil { if a == nil || a.connMgr == nil {
return return
@@ -41,7 +47,7 @@ func (a *dnsPeerActivator) ActivatePeersByIP(ctx context.Context, ips []string)
if !ok { if !ok {
continue continue
} }
a.connMgr.ActivatePeer(ctx, conn) a.connMgr.ActivatePeer(a.ctx, conn)
pending = append(pending, ip) pending = append(pending, ip)
} }
a.mu.Unlock() a.mu.Unlock()
+1
View File
@@ -663,6 +663,7 @@ func (e *Engine) Start(netbirdConfig *mgmProto.NetbirdConfig, mgmtURL *url.URL)
peerStore: e.peerStore, peerStore: e.peerStore,
status: e.statusRecorder, status: e.statusRecorder,
mu: e.syncMsgMux, mu: e.syncMsgMux,
ctx: e.ctx,
}) })
} }
+1 -1
View File
@@ -92,7 +92,7 @@ func availableProviders() []providerCase {
region = "us-east-1" region = "us-east-1"
} }
// A valid Bedrock inference-profile id (region prefix + date + version), // A valid Bedrock inference-profile id (region prefix + date + version),
// overridable per account. `global.` profiles are invokable from any // overridable per account. `global.` profiles can be invoked from any
// region; set AWS_BEDROCK_MODEL to match the enabled profile for the token. // region; set AWS_BEDROCK_MODEL to match the enabled profile for the token.
model := os.Getenv("AWS_BEDROCK_MODEL") model := os.Getenv("AWS_BEDROCK_MODEL")
if model == "" { if model == "" {