[#349] client: Use context.Background
in Dial
by default
Passing `nil` context to `rpc.Balance` leads to panic. To prevent panic, we need to provide some default context in `Dial`. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
parent
8c682641bf
commit
d2f3929b51
1 changed files with 4 additions and 0 deletions
|
@ -105,6 +105,10 @@ func (c *Client) Dial(prm PrmDial) error {
|
||||||
|
|
||||||
c.setNeoFSAPIServer((*coreServer)(&c.c))
|
c.setNeoFSAPIServer((*coreServer)(&c.c))
|
||||||
|
|
||||||
|
if prm.parentCtx == nil {
|
||||||
|
prm.parentCtx = context.Background()
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: (neofs-api-go#382) perform generic dial stage of the client.Client
|
// TODO: (neofs-api-go#382) perform generic dial stage of the client.Client
|
||||||
_, err := rpc.Balance(&c.c, new(v2accounting.BalanceRequest),
|
_, err := rpc.Balance(&c.c, new(v2accounting.BalanceRequest),
|
||||||
client.WithContext(prm.parentCtx),
|
client.WithContext(prm.parentCtx),
|
||||||
|
|
Loading…
Reference in a new issue