Skip to content

Commit 90f619d

Browse files
committed
fixup
1 parent 91f8009 commit 90f619d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

vpn/tunnel.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,24 +607,24 @@ func (u *updater) netStatusLoop() {
607607
case <-u.ctx.Done():
608608
return
609609
case <-ticker.C:
610-
u.recordLatency()
610+
u.recordLatencies()
611611
u.sendAgentUpdate()
612612
}
613613
}
614614
}
615615

616-
func (u *updater) recordLatency() {
616+
func (u *updater) recordLatencies() {
617617
var agentsIDsToPing []uuid.UUID
618618
u.mu.Lock()
619619
for _, agent := range u.agents {
620620
agentsIDsToPing = append(agentsIDsToPing, agent.ID)
621621
}
622622
u.mu.Unlock()
623623

624-
pingCtx, cancelFunc := context.WithTimeout(u.ctx, 5*time.Second)
625-
defer cancelFunc()
626624
for _, agentID := range agentsIDsToPing {
627625
go func() {
626+
pingCtx, cancelFunc := context.WithTimeout(u.ctx, 5*time.Second)
627+
defer cancelFunc()
628628
pingDur, didP2p, pingResult, err := u.conn.Ping(pingCtx, agentID)
629629
if err != nil {
630630
u.logger.Warn(u.ctx, "failed to ping agent", slog.F("agent_id", agentID), slog.Error(err))

0 commit comments

Comments
 (0)