From 683d20c516649806ccceb423cf49592ac13d4a66 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Tue, 28 Nov 2023 15:01:02 +0100 Subject: [PATCH] refactor(webconnectivitylte): {Append,Prepend}Requests (#1396) The new name is more accurate because we need to prepend to requests such that the last request ends up being first in the list. Part of https://github.com/ooni/probe/issues/2634 --- internal/experiment/webconnectivitylte/cleartextflow.go | 2 +- internal/experiment/webconnectivitylte/secureflow.go | 2 +- internal/experiment/webconnectivitylte/testkeys.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/experiment/webconnectivitylte/cleartextflow.go b/internal/experiment/webconnectivitylte/cleartextflow.go index 8ec7cc663c..57650736e5 100644 --- a/internal/experiment/webconnectivitylte/cleartextflow.go +++ b/internal/experiment/webconnectivitylte/cleartextflow.go @@ -274,7 +274,7 @@ func (t *CleartextFlow) httpTransaction(ctx context.Context, network, address, a err, finished, ) - t.TestKeys.AppendRequests(ev) + t.TestKeys.PrependRequests(ev) return resp, body, err } diff --git a/internal/experiment/webconnectivitylte/secureflow.go b/internal/experiment/webconnectivitylte/secureflow.go index 6284eca649..2e634467df 100644 --- a/internal/experiment/webconnectivitylte/secureflow.go +++ b/internal/experiment/webconnectivitylte/secureflow.go @@ -329,7 +329,7 @@ func (t *SecureFlow) httpTransaction(ctx context.Context, network, address, alpn err, finished, ) - t.TestKeys.AppendRequests(ev) + t.TestKeys.PrependRequests(ev) return resp, body, err } diff --git a/internal/experiment/webconnectivitylte/testkeys.go b/internal/experiment/webconnectivitylte/testkeys.go index dd2e5be31a..b580659116 100644 --- a/internal/experiment/webconnectivitylte/testkeys.go +++ b/internal/experiment/webconnectivitylte/testkeys.go @@ -217,8 +217,8 @@ func (tk *TestKeys) AppendQueries(v ...*model.ArchivalDNSLookupResult) { tk.mu.Unlock() } -// AppendRequests appends to Requests. -func (tk *TestKeys) AppendRequests(v ...*model.ArchivalHTTPRequestResult) { +// PrependRequests prepends to Requests. +func (tk *TestKeys) PrependRequests(v ...*model.ArchivalHTTPRequestResult) { tk.mu.Lock() // Implementation note: append at the front since the most recent // request must be at the beginning of the list.