Compare commits

..

1 commit

Author SHA1 Message Date
c3bb283cce [#301] rpc: Make client stream initialization get cancelled by dial timeout
All checks were successful
DCO / DCO (pull_request) Successful in 5m3s
Tests and linters / Tests (pull_request) Successful in 5m19s
Tests and linters / Lint (pull_request) Successful in 6m13s
* `c.conn` may be already invalidated but the rpc client can't detect this.
  `NewStream` may hang trying to open a stream with invalidated connection.
  Using timer with `dialTimeout` for `NewStream` fixes this problem.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-12-06 10:47:39 +03:00

View file

@ -80,6 +80,7 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe
case <-newStreamCh: case <-newStreamCh:
default: default:
cancel() cancel()
<-newStreamCh
return nil, context.Canceled return nil, context.Canceled
} }
case <-newStreamCh: case <-newStreamCh: