[#131] client: get rid of slices.Equal
Signed-off-by: olefirenque <egor.olefirenko892@gmail.com>
This commit is contained in:
parent
6ace44f6b5
commit
dd8fb59efe
1 changed files with 14 additions and 2 deletions
|
@ -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]})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue