[#131] client: get rid of slices.Equal
Some checks failed
DCO / DCO (pull_request) Successful in 1m0s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m24s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m30s
Tests and linters / Lint (pull_request) Failing after 1m50s

Signed-off-by: olefirenque <egor.olefirenko892@gmail.com>
This commit is contained in:
Egor Olefirenko 2023-11-30 13:26:21 +03:00
parent 6ace44f6b5
commit dd8fb59efe

View file

@ -8,7 +8,6 @@ import (
"fmt"
netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
"net/url"
"slices"
"time"
v2accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting"
@ -119,10 +118,23 @@ func (c *Client) NetMapDial(ctx context.Context, endpoint string) error {
if err != nil {
return err
}
isEqualSlices := func(a, b []byte) bool {
if len(a) != len(b) {
return false
}
for i := range a {
if a[i] != b[i] {
return false
}
}
return true
}
if u.Scheme == "frostfs" {
nodes := c.prm.NetMap.GetNodes()
for _, node := range nodes {
if slices.Equal([]byte(u.Host), node.PublicKey) {
if isEqualSlices([]byte(u.Host), node.PublicKey) {
return c.Dial(ctx, PrmDial{Endpoint: node.Addresses[0]})
}
}