aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Fifield <david@bamsoftware.com>2023-04-04 19:09:47 -0600
committerDavid Fifield <david@bamsoftware.com>2023-04-04 19:12:22 -0600
commit97c930013b2e5fa4cf81af636e94b38ad0632033 (patch)
tree2725e0ba26bc95e590dcfd212aeb6d46fcf978a6
parent6bae31f07782776fb4c289dec6f7e10233609eef (diff)
downloadsnowflake-97c930013b2e5fa4cf81af636e94b38ad0632033.tar.gz
snowflake-97c930013b2e5fa4cf81af636e94b38ad0632033.zip
Fix loop termination in TestQueuePacketConnWriteToKCP.
The noise-generating goroutine was meant to stop when the parent function returned and closed the `done` channel. The `break` in the loop was wrongly exiting only from the `select`, not from the `for`. This was the cause of banchmark anomalies in https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40260#note_2885832. The noise-generating loop from the test was continuing to run while the benchmarks were running.
-rw-r--r--common/turbotunnel/queuepacketconn_test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/turbotunnel/queuepacketconn_test.go b/common/turbotunnel/queuepacketconn_test.go
index 2bb4eeb..37f46bc 100644
--- a/common/turbotunnel/queuepacketconn_test.go
+++ b/common/turbotunnel/queuepacketconn_test.go
@@ -99,10 +99,11 @@ func TestQueuePacketConnWriteToKCP(t *testing.T) {
defer readyClose.Do(func() { close(ready) })
pconn := DiscardPacketConn{}
defer pconn.Close()
+ loop:
for {
select {
case <-done:
- break
+ break loop
default:
}
// Create a new UDPSession, send once, then discard the