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
This commit is contained in:
Cecylia Bocovich 2025-01-22 14:55:58 -05:00
parent b9e7865c50
commit 452a6d22b1
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90

View file

@ -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")
}