Compare commits
1 commit
cbc59f82fb
...
a5a399f748
Author | SHA1 | Date | |
---|---|---|---|
a5a399f748 |
1 changed files with 1 additions and 2 deletions
|
@ -52,6 +52,7 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe
|
|||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(prm.ctx)
|
||||
defer cancel()
|
||||
|
||||
// `conn.NewStream` doesn't check if `conn` may turn up invalidated right before this invocation.
|
||||
// In such cases, the operation can hang indefinitely, with the context timeout being the only
|
||||
|
@ -79,14 +80,12 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe
|
|||
select {
|
||||
case <-newStreamCh:
|
||||
default:
|
||||
cancel()
|
||||
return nil, context.Canceled
|
||||
}
|
||||
case <-newStreamCh:
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
cancel()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue