mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
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.
This commit is contained in:
parent
6bae31f077
commit
97c930013b
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue