From f43e732e4b140f7db7558598c242ee1f480202a4 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Mon, 24 Jul 2017 15:50:46 +0700 Subject: [PATCH] fix a race condition in a session test We were relying on the run-loop to set handshakeComplete to true, while at the same time sending packets. select doesn't guarantee the order of execution when multiple cases can run. The fix is setting handshakeComplete to true directly. --- session_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session_test.go b/session_test.go index 91c6fe488..324db22d7 100644 --- a/session_test.go +++ b/session_test.go @@ -1377,7 +1377,7 @@ var _ = Describe("Session", func() { }) It("ignores undecryptable packets after the handshake is complete", func() { - close(aeadChanged) + sess.handshakeComplete = true go sess.run() sendUndecryptablePackets() Consistently(sess.undecryptablePackets).Should(BeEmpty())