From 34a461b33486d5f98b39381c1759c7588106454a Mon Sep 17 00:00:00 2001 From: Nikita Kryuchkov Date: Wed, 23 Oct 2019 22:50:08 +0300 Subject: [PATCH] Fix data race --- pkg/snet/stcp/client_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/snet/stcp/client_test.go b/pkg/snet/stcp/client_test.go index 585385567..d06a53a74 100644 --- a/pkg/snet/stcp/client_test.go +++ b/pkg/snet/stcp/client_test.go @@ -33,12 +33,16 @@ func prepareConns(t *testing.T) (*Conn, *Conn, func()) { var b *Conn var respErr error + done := make(chan struct{}) go func() { b, respErr = newConn(bConn, time.Now().Add(HandshakeTimeout), rhs, nil) + close(done) }() a, err := newConn(aConn, time.Now().Add(HandshakeTimeout), ihs, nil) require.NoError(t, err) + + <-done require.NoError(t, respErr) closeFunc := func() {