network: fix datarace in TCPTransport

This commit is contained in:
Evgenii Stratonikov 2020-09-02 13:21:24 +03:00
parent fd98a9194a
commit 914b12af44

View file

@ -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.