diff --git a/go.mod b/go.mod index 88751208e8..21a26c12a8 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/multiformats/go-multiaddr v0.3.1 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.0 - github.com/nspcc-dev/neofs-api-go v1.26.2-0.20210528133202-6cd349738889 + github.com/nspcc-dev/neofs-api-go v1.26.2-0.20210531071300-89be8d3f5ada github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 diff --git a/go.sum b/go.sum index 6ae40af0bf..0c8a5ef70c 100644 Binary files a/go.sum and b/go.sum differ diff --git a/pkg/network/cache/client.go b/pkg/network/cache/client.go index b386c32edb..2e77ada0b4 100644 --- a/pkg/network/cache/client.go +++ b/pkg/network/cache/client.go @@ -75,3 +75,21 @@ func (c *ClientCache) Get(netAddr *network.Address) (client.Client, error) { return cli, nil } + +// CloseAll closes underlying connections of all cached clients. +// +// Ignores closing errors. +func (c *ClientCache) CloseAll() { + c.mu.RLock() + + { + for _, cl := range c.clients { + con := cl.Conn() + if con != nil { + _ = con.Close() + } + } + } + + c.mu.RUnlock() +}