Skip to content
  • David Fifield's avatar
    Close temporary UDPSession in TestQueuePacketConnWriteToKCP. · 58c3121c
    David Fifield authored
    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
    ```
    58c3121c
Loading