mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-16 19:14:41 -07:00
Fix data read race
This commit is contained in:
@@ -114,10 +114,14 @@ func (c *client) initClient() {
|
||||
func (c *client) readLoop() {
|
||||
// Grab the connection off the client, it will be cleared on a close.
|
||||
// We check for that after the loop, but want to avoid a nil dereference
|
||||
c.mu.Lock()
|
||||
nc := c.nc
|
||||
c.mu.Unlock()
|
||||
|
||||
if nc == nil {
|
||||
return
|
||||
}
|
||||
|
||||
b := make([]byte, defaultBufSize)
|
||||
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user