network: fix datarace in TCPTransport
This commit is contained in:
parent
fd98a9194a
commit
914b12af44
1 changed files with 2 additions and 0 deletions
|
@ -79,9 +79,11 @@ func (t *TCPTransport) isCloseError(err error) bool {
|
||||||
|
|
||||||
// Close implements the Transporter interface.
|
// Close implements the Transporter interface.
|
||||||
func (t *TCPTransport) Close() {
|
func (t *TCPTransport) Close() {
|
||||||
|
t.lock.Lock()
|
||||||
if t.listener != nil {
|
if t.listener != nil {
|
||||||
t.listener.Close()
|
t.listener.Close()
|
||||||
}
|
}
|
||||||
|
t.lock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proto implements the Transporter interface.
|
// Proto implements the Transporter interface.
|
||||||
|
|
Loading…
Reference in a new issue