mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-28 11:36:17 +00:00
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:
parent
649fe58550
commit
6b2fc5e056
2 changed files with 6 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -66,6 +66,7 @@ run:
|
|||
}
|
||||
}
|
||||
}
|
||||
c.client.Close()
|
||||
drain:
|
||||
for {
|
||||
select {
|
||||
|
|
Loading…
Reference in a new issue