Skip to content

Commit 4497d68

Browse files
committed
Move time.Sleep call in turbotunnel test
An update the the kcp-go library removes the guarantee that all data written to a KCP connection will be flushed before the connection is closed. Moving the sleep call has no impact on the integrity of the tests, and gives the connection time to flush data before the connection is closed. See xtaci/kcp-go#273
1 parent 99521fb commit 4497d68

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

common/turbotunnel/queuepacketconn_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,16 @@ func TestQueuePacketConnWriteToKCP(t *testing.T) {
208208
panic(err)
209209
}
210210

211+
// A sleep after the Write makes buffer reuse more likely, and is needed
212+
// to allow time for flushing all bytes written to the connection before close.
213+
// This is not guaranteed by kcp-go. See https://github.com/xtaci/kcp-go/issues/273
214+
time.Sleep(100 * time.Millisecond)
215+
211216
err = conn.Close()
212217
if err != nil {
213218
panic(err)
214219
}
215220

216-
// A sleep after the Write makes buffer reuse more likely.
217-
time.Sleep(100 * time.Millisecond)
218-
219221
if len(transcript.Transcript) == 0 {
220222
panic("empty transcript")
221223
}

0 commit comments

Comments
 (0)