From 730b00ff730ea94e51bba54c2dd176d744dd34a2 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Thu, 14 Oct 2021 12:16:55 +0200 Subject: [PATCH] fix(ooniprobe): Measure returns EITHER measurement OR error now (#544) See https://github.com/ooni/probe/issues/1816 This diff addresses the most immediate issue but there is probably extra work to do, including testing and making sure experiments do not return an error when they should not. --- cmd/ooniprobe/internal/nettests/nettests.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/ooniprobe/internal/nettests/nettests.go b/cmd/ooniprobe/internal/nettests/nettests.go index faf653b..4a27893 100644 --- a/cmd/ooniprobe/internal/nettests/nettests.go +++ b/cmd/ooniprobe/internal/nettests/nettests.go @@ -165,10 +165,14 @@ func (c *Controller) Run(builder *engine.ExperimentBuilder, inputs []string) err if err := c.msmts[idx64].Failed(c.Probe.DB(), err.Error()); err != nil { return errors.Wrap(err, "failed to mark measurement as failed") } - // Even with a failed measurement, we want to continue. We want to - // record and submit the information we have. Saving the information - // is useful for local inspection. Submitting it is useful to us to - // understand what went wrong (censorship? bug? anomaly?). + // Since https://github.com/ooni/probe-cli/pull/527, the Measure + // function returns EITHER a valid measurement OR an error. Before + // that, instead, the measurement was valid EVEN in case of an + // error, which is quite not the OR semantics that + // is so typical and widespread in the Go ecosystem. So, we must + // jump to the next iteration of the loop here rather than falling + // through and attempting to do something with the measurement. + continue } saveToDisk := true