From b81af5b0583806ff362e080d3439c5050eb65748 Mon Sep 17 00:00:00 2001 From: DecFox <33030671+DecFox@users.noreply.github.com> Date: Fri, 6 May 2022 14:17:26 +0530 Subject: [PATCH] feat(torsf): add default_timeout test keys (#709) See https://github.com/ooni/probe/issues/2061 --- internal/engine/experiment/torsf/torsf.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/engine/experiment/torsf/torsf.go b/internal/engine/experiment/torsf/torsf.go index 705e6f6..c932e72 100644 --- a/internal/engine/experiment/torsf/torsf.go +++ b/internal/engine/experiment/torsf/torsf.go @@ -42,6 +42,9 @@ type TestKeys struct { // BootstrapTime contains the bootstrap time on success. BootstrapTime float64 `json:"bootstrap_time"` + // DefaultTimeout contains the default timeout for torsf + DefaultTimeout float64 `json:"default_timeout"` + // Failure contains the failure string or nil. Failure *string `json:"failure"` @@ -113,7 +116,7 @@ func (m *Measurer) Run( tkch := make(chan *TestKeys) ticker := time.NewTicker(2 * time.Second) defer ticker.Stop() - go m.bootstrap(ctx, sess, tkch, ptl, sfdialer) + go m.bootstrap(ctx, maxRuntime, sess, tkch, ptl, sfdialer) for { select { case tk := <-tkch: @@ -159,10 +162,11 @@ func (m *Measurer) setup(ctx context.Context, } // bootstrap runs the bootstrap. -func (m *Measurer) bootstrap(ctx context.Context, sess model.ExperimentSession, +func (m *Measurer) bootstrap(ctx context.Context, timeout time.Duration, sess model.ExperimentSession, out chan<- *TestKeys, ptl *ptx.Listener, sfdialer *ptx.SnowflakeDialer) { tk := &TestKeys{ BootstrapTime: 0, + DefaultTimeout: timeout.Seconds(), Failure: nil, PersistentDatadir: !m.config.DisablePersistentDatadir, RendezvousMethod: sfdialer.RendezvousMethod.Name(),