Browse Source

Merge pull request #881 from Zariel/conn/fix-close-race

conn: hold mutex while creating calls
Chris Bannister 8 years ago
parent
commit
c0430476aa
1 changed files with 1 additions and 1 deletions
  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()