From 452a6d22b175bac5a5defcfcd3f11ad2254c088e Mon Sep 17 00:00:00 2001 From: Cecylia Bocovich Date: Wed, 22 Jan 2025 14:55:58 -0500 Subject: [PATCH] Move and increase sleep time in queuepacketconn test This should give written data enough time to make it to the post processing queue before the connection is closed. See https://github.com/xtaci/kcp-go/issues/273 --- common/turbotunnel/queuepacketconn_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/turbotunnel/queuepacketconn_test.go b/common/turbotunnel/queuepacketconn_test.go index 3b4c848..0ff19b2 100644 --- a/common/turbotunnel/queuepacketconn_test.go +++ b/common/turbotunnel/queuepacketconn_test.go @@ -215,14 +215,15 @@ func TestQueuePacketConnWriteToKCP(t *testing.T) { panic(err) } + // A sleep after the Write makes buffer reuse more likely, + // and to allow the connection to flush before close + time.Sleep(500 * time.Millisecond) + err = conn.Close() if err != nil { panic(err) } - // A sleep after the Write makes buffer reuse more likely. - time.Sleep(100 * time.Millisecond) - if transcript.Length() == 0 { panic("empty transcript") }