Fix "Fix gLazyConn race"
This commit is contained in:
parent
3df19f464e
commit
bea26198e7
1 changed files with 12 additions and 0 deletions
|
|
@ -145,8 +145,12 @@ func (c *gLazyConn) Close() error {
|
||||||
c.handshakeErr = net.ErrClosed
|
c.handshakeErr = net.ErrClosed
|
||||||
c.handshakeDone = true
|
c.handshakeDone = true
|
||||||
return nil
|
return nil
|
||||||
|
} else if c.handshakeErr != nil {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
c.handshakeAccess.Unlock()
|
c.handshakeAccess.Unlock()
|
||||||
|
} else if c.handshakeErr != nil {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return c.tcpConn.Close()
|
return c.tcpConn.Close()
|
||||||
}
|
}
|
||||||
|
|
@ -159,8 +163,12 @@ func (c *gLazyConn) CloseRead() error {
|
||||||
c.handshakeErr = net.ErrClosed
|
c.handshakeErr = net.ErrClosed
|
||||||
c.handshakeDone = true
|
c.handshakeDone = true
|
||||||
return nil
|
return nil
|
||||||
|
} else if c.handshakeErr != nil {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
c.handshakeAccess.Unlock()
|
c.handshakeAccess.Unlock()
|
||||||
|
} else if c.handshakeErr != nil {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return c.tcpConn.CloseRead()
|
return c.tcpConn.CloseRead()
|
||||||
}
|
}
|
||||||
|
|
@ -173,8 +181,12 @@ func (c *gLazyConn) CloseWrite() error {
|
||||||
c.handshakeErr = net.ErrClosed
|
c.handshakeErr = net.ErrClosed
|
||||||
c.handshakeDone = true
|
c.handshakeDone = true
|
||||||
return nil
|
return nil
|
||||||
|
} else if c.handshakeErr != nil {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
c.handshakeAccess.Unlock()
|
c.handshakeAccess.Unlock()
|
||||||
|
} else if c.handshakeErr != nil {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return c.tcpConn.CloseRead()
|
return c.tcpConn.CloseRead()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue