[#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:
Leonard Lyubich 2022-10-12 14:20:46 +04:00 committed by LeL
parent 8c682641bf
commit d2f3929b51

View file

@ -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),