From 3a4e951f8c1c3a9d1608db49223fcd7e3c76370d Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Fri, 9 Feb 2024 18:38:31 +0100 Subject: [PATCH] x --- internal/experiment/webconnectivitylte/cleartextflow.go | 7 ++++++- internal/experiment/webconnectivitylte/secureflow.go | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/experiment/webconnectivitylte/cleartextflow.go b/internal/experiment/webconnectivitylte/cleartextflow.go index 27399c926..142719718 100644 --- a/internal/experiment/webconnectivitylte/cleartextflow.go +++ b/internal/experiment/webconnectivitylte/cleartextflow.go @@ -125,7 +125,12 @@ func (t *CleartextFlow) Run(parentCtx context.Context, index int64) error { tcpConn, err := tcpDialer.DialContext(tcpCtx, "tcp", t.Address) t.TestKeys.AppendTCPConnectResults(trace.TCPConnects()...) defer func() { - t.TestKeys.AppendNetworkEvents(trace.NetworkEvents()...) // here to include "connect" events + // BUGFIX: we must call trace.NetworkEvents()... inside the defer block otherwise + // we miss the read/write network events. See https://github.com/ooni/probe/issues/2674. + // + // Additionally, we must register this defer here because we want to include + // the "connect" event in case connect has failed. + t.TestKeys.AppendNetworkEvents(trace.NetworkEvents()...) }() if err != nil { ol.Stop(err) diff --git a/internal/experiment/webconnectivitylte/secureflow.go b/internal/experiment/webconnectivitylte/secureflow.go index 8a818de2d..658c1e0b5 100644 --- a/internal/experiment/webconnectivitylte/secureflow.go +++ b/internal/experiment/webconnectivitylte/secureflow.go @@ -132,7 +132,12 @@ func (t *SecureFlow) Run(parentCtx context.Context, index int64) error { tcpConn, err := tcpDialer.DialContext(tcpCtx, "tcp", t.Address) t.TestKeys.AppendTCPConnectResults(trace.TCPConnects()...) defer func() { - t.TestKeys.AppendNetworkEvents(trace.NetworkEvents()...) // here to include "connect" events + // BUGFIX: we must call trace.NetworkEvents()... inside the defer block otherwise + // we miss the read/write network events. See https://github.com/ooni/probe/issues/2674. + // + // Additionally, we must register this defer here because we want to include + // the "connect" event in case connect has failed. + t.TestKeys.AppendNetworkEvents(trace.NetworkEvents()...) }() if err != nil { ol.Stop(err)