From ee71c966fd7a6a0b9f697746da2e6178b7ac8398 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 14 Jul 2021 12:05:39 -0700 Subject: [PATCH] cmd/derpprobe: bound node pair probe duration Signed-off-by: Brad Fitzpatrick --- cmd/derpprobe/derpprobe.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/derpprobe/derpprobe.go b/cmd/derpprobe/derpprobe.go index 47b30bcdf..363d4983d 100644 --- a/cmd/derpprobe/derpprobe.go +++ b/cmd/derpprobe/derpprobe.go @@ -190,6 +190,16 @@ func probe() error { } func probeNodePair(ctx context.Context, dm *tailcfg.DERPMap, from, to *tailcfg.DERPNode) (latency time.Duration, err error) { + // The passed in context is a minute for the whole region. The + // idea is that each node pair in the region will be done + // serially and regularly in the future, reusing connections + // (at least in the happy path). For now they don't reuse + // connections and probe at most once every 15 seconds. We + // bound the duration of a single node pair within a region + // so one bad one can't starve others. + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + fromc, err := newConn(ctx, dm, from) if err != nil { return 0, err