aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Fifield <david@bamsoftware.com>2023-06-29 21:10:58 +0000
committerDavid Fifield <david@bamsoftware.com>2023-06-29 21:12:29 +0000
commit58c3121c6b3afe54ddb31edc5efca613142bbe4e (patch)
tree3bf39c3c29c165e93d205c226ba81ebe38f55aa6
parent80980a3afb664b6ad019390f7f9b5a2f67cd5a9f (diff)
downloadsnowflake-58c3121c6b3afe54ddb31edc5efca613142bbe4e.tar.gz
snowflake-58c3121c6b3afe54ddb31edc5efca613142bbe4e.zip
Close temporary UDPSession in TestQueuePacketConnWriteToKCP.
With these not being closed, they were continuing to consume resources after the return of the test function, which was affecting the later BenchmarkSendQueue. Before: ``` snowflake/common/turbotunnel$ go test -bench BenchmarkSendQueue -v === RUN TestQueueIncomingOversize --- PASS: TestQueueIncomingOversize (0.00s) === RUN TestWriteToOversize --- PASS: TestWriteToOversize (0.00s) === RUN TestRestoreMTU --- PASS: TestRestoreMTU (0.00s) === RUN TestRestoreCap --- PASS: TestRestoreCap (0.00s) === RUN TestQueuePacketConnWriteToKCP --- PASS: TestQueuePacketConnWriteToKCP (1.01s) goos: linux goarch: amd64 pkg: gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/turbotunnel cpu: Intel(R) Core(TM) i5 CPU 680 @ 3.60GHz BenchmarkSendQueue BenchmarkSendQueue-4 8519708 136.0 ns/op PASS ok gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/turbotunnel 3.481s ``` After: ``` snowflake/common/turbotunnel$ go test -bench BenchmarkSendQueue -v === RUN TestQueueIncomingOversize --- PASS: TestQueueIncomingOversize (0.00s) === RUN TestWriteToOversize --- PASS: TestWriteToOversize (0.00s) === RUN TestRestoreMTU --- PASS: TestRestoreMTU (0.00s) === RUN TestRestoreCap --- PASS: TestRestoreCap (0.00s) === RUN TestQueuePacketConnWriteToKCP --- PASS: TestQueuePacketConnWriteToKCP (1.02s) goos: linux goarch: amd64 pkg: gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/turbotunnel cpu: Intel(R) Core(TM) i5 CPU 680 @ 3.60GHz BenchmarkSendQueue BenchmarkSendQueue-4 11620237 105.7 ns/op PASS ok gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/turbotunnel 3.244s ```
-rw-r--r--common/turbotunnel/queuepacketconn_test.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/common/turbotunnel/queuepacketconn_test.go b/common/turbotunnel/queuepacketconn_test.go
index b9f62c9..30e69e3 100644
--- a/common/turbotunnel/queuepacketconn_test.go
+++ b/common/turbotunnel/queuepacketconn_test.go
@@ -182,6 +182,7 @@ func TestQueuePacketConnWriteToKCP(t *testing.T) {
if err != nil {
panic(err)
}
+ conn.Close()
// Signal the main test to start once we have done one
// iterator of this noisy loop.
readyClose.Do(func() { close(ready) })