Fix "Fix gLazyConn race"

This commit is contained in:
世界 2025-06-15 17:30:35 +08:00
parent 3df19f464e
commit bea26198e7
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -145,8 +145,12 @@ func (c *gLazyConn) Close() error {
c.handshakeErr = net.ErrClosed
c.handshakeDone = true
return nil
} else if c.handshakeErr != nil {
return nil
}
c.handshakeAccess.Unlock()
} else if c.handshakeErr != nil {
return nil
}
return c.tcpConn.Close()
}
@ -159,8 +163,12 @@ func (c *gLazyConn) CloseRead() error {
c.handshakeErr = net.ErrClosed
c.handshakeDone = true
return nil
} else if c.handshakeErr != nil {
return nil
}
c.handshakeAccess.Unlock()
} else if c.handshakeErr != nil {
return nil
}
return c.tcpConn.CloseRead()
}
@ -173,8 +181,12 @@ func (c *gLazyConn) CloseWrite() error {
c.handshakeErr = net.ErrClosed
c.handshakeDone = true
return nil
} else if c.handshakeErr != nil {
return nil
}
c.handshakeAccess.Unlock()
} else if c.handshakeErr != nil {
return nil
}
return c.tcpConn.CloseRead()
}