cmd/stunstamp: cleanup timeout and interval constants (#13393)

Updates #cleanup

Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
Jordan Whited
2024-09-05 13:40:12 -07:00
committed by GitHub
parent e7b5e8c8cd
commit 95f0094310
2 changed files with 17 additions and 8 deletions
+5 -5
View File
@@ -107,7 +107,7 @@ func measureICMPRTT(source timestampSource, conn io.ReadWriteCloser, _ string, d
}
if source == timestampSourceKernel {
txCtx, txCancel := context.WithTimeout(context.Background(), time.Second*2)
txCtx, txCancel := context.WithTimeout(context.Background(), txRxTimeout)
defer txCancel()
buf := make([]byte, 1024)
@@ -142,8 +142,8 @@ func measureICMPRTT(source timestampSource, conn io.ReadWriteCloser, _ string, d
}
}
rxCtx, txCancel := context.WithTimeout(context.Background(), time.Second*2)
defer txCancel()
rxCtx, rxCancel := context.WithTimeout(context.Background(), txRxTimeout)
defer rxCancel()
rxBuf := make([]byte, 1024)
oob := make([]byte, 1024)
@@ -210,7 +210,7 @@ func measureSTUNRTTKernel(conn io.ReadWriteCloser, _ string, dst netip.AddrPort)
return 0, fmt.Errorf("sendto error: %v", err) // don't wrap
}
txCtx, txCancel := context.WithTimeout(context.Background(), time.Second*2)
txCtx, txCancel := context.WithTimeout(context.Background(), txRxTimeout)
defer txCancel()
buf := make([]byte, 1024)
@@ -236,7 +236,7 @@ func measureSTUNRTTKernel(conn io.ReadWriteCloser, _ string, dst netip.AddrPort)
break
}
rxCtx, rxCancel := context.WithTimeout(context.Background(), time.Second*2)
rxCtx, rxCancel := context.WithTimeout(context.Background(), txRxTimeout)
defer rxCancel()
for {