diff --git a/pkg/snet/arclient/client.go b/pkg/snet/arclient/client.go index 360d4467d7..c51d02dd7c 100644 --- a/pkg/snet/arclient/client.go +++ b/pkg/snet/arclient/client.go @@ -432,10 +432,9 @@ func (c *httpClient) Close() error { if err := c.sudphConn.Close(); err != nil { c.log.WithError(err).Errorf("Failed to close SUDPH") } + close(c.closed) } - close(c.closed) - return nil } diff --git a/pkg/snet/network.go b/pkg/snet/network.go index 128e6b576f..24162bc88c 100644 --- a/pkg/snet/network.go +++ b/pkg/snet/network.go @@ -274,18 +274,13 @@ func (n *Network) Close() error { if directClient == nil { continue } - wg.Add(1) - go func(client directtp.Client) { - err := client.Close() - if err != nil { - directErrors <- err - } - wg.Done() - }(directClient) + err := directClient.Close() + if err != nil { + directErrors <- err + } } - wg.Wait() close(directErrors) - + wg.Wait() if dmsgErr != nil { return dmsgErr }