mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-25 22:09:08 +01:00
[client] tie DNS warm-up dial to engine context; fix codespell
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
@@ -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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user