Skip to content

Commit

Permalink
conn: close timeout chan before relesing stream to prevent race
Browse files Browse the repository at this point in the history
  • Loading branch information
Zariel committed May 21, 2018
1 parent e4f695e commit 95711e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,13 +711,13 @@ func (c *Conn) sendFrame(ctx context.Context, call *callReq, timeoutCh <-chan ti
case c.frameWriteArgChan <- call:
return nil
case <-timeoutCh:
c.releaseStream(call.streamID)
close(call.timeout)
c.releaseStream(call.streamID)
c.handleTimeout()
return ErrTimeoutNoResponse
case <-ctxDone:
c.releaseStream(call.streamID)
close(call.timeout)
c.releaseStream(call.streamID)
return ctx.Err()
case <-c.quit:
return ErrConnectionClosed
Expand Down

0 comments on commit 95711e6

Please sign in to comment.