Bläddra i källkod

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 8 år sedan
förälder
incheckning
c0389b8022
1 ändrade filer med 1 tillägg och 1 borttagningar
  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()