rpc/client: add Close method

Allow to close unused network connections and use it during RPC broadcaster
shutdown, because otherwise we leak them.
This commit is contained in:
Roman Khimov 2022-07-01 23:07:37 +03:00
parent 649fe58550
commit 6b2fc5e056
2 changed files with 6 additions and 0 deletions

View file

@ -167,6 +167,11 @@ func (c *Client) Init() error {
return nil
}
// Close closes unused underlying networks connections.
func (c *Client) Close() {
c.cli.CloseIdleConnections()
}
func (c *Client) performRequest(method string, p request.RawParams, v interface{}) error {
var r = request.Raw{
JSONRPC: request.JSONRPCVersion,

View file

@ -66,6 +66,7 @@ run:
}
}
}
c.client.Close()
drain:
for {
select {