From 914b12af44e2fbf83322536b7d3f33a00e7d3855 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Sep 2020 13:21:24 +0300 Subject: [PATCH] network: fix datarace in TCPTransport --- pkg/network/tcp_transport.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/network/tcp_transport.go b/pkg/network/tcp_transport.go index 7bf0e39eb..3a7a7a1b8 100644 --- a/pkg/network/tcp_transport.go +++ b/pkg/network/tcp_transport.go @@ -79,9 +79,11 @@ func (t *TCPTransport) isCloseError(err error) bool { // Close implements the Transporter interface. func (t *TCPTransport) Close() { + t.lock.Lock() if t.listener != nil { t.listener.Close() } + t.lock.Unlock() } // Proto implements the Transporter interface.