Explorar el Código

conn: hold mutex while creating calls

closeWithError will hold the lock and close the channel, which we could
be assigning at the same time.
Chris Bannister hace 8 años
padre
commit
c0389b8022
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      conn.go

+ 1 - 1
conn.go

@@ -590,11 +590,11 @@ func (c *Conn) exec(ctx context.Context, req frameWriter, tracer Tracer) (*frame
 		call = streamPool.Get().(*callReq)
 	}
 	c.calls[stream] = call
-	c.mu.Unlock()
 
 	call.framer = framer
 	call.timeout = make(chan struct{})
 	call.streamID = stream
+	c.mu.Unlock()
 
 	if tracer != nil {
 		framer.trace()