Skip to content

Commit

Permalink
fix/close-invoke-race: fixing logical race when Close is called befor…
Browse files Browse the repository at this point in the history
…e Invoke
  • Loading branch information
patrickhuie19 committed Dec 8, 2023
1 parent fef92b5 commit 82f7fce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ func (cc *ClientConn) Close() {
// Invoke sends the RPC request on the wire and returns after response is
// received.
func (cc *ClientConn) Invoke(ctx context.Context, method string, args interface{}, reply interface{}) error {
if cc.conn == nil {
// Close() has been called
return errors.New("client Close() called")
}

// Ensure the connection state is ready
cc.mu.RLock()
cc.conn.mu.RLock()
Expand Down

0 comments on commit 82f7fce

Please sign in to comment.