[#607] network: Accept value instead of pointer in IsLocalAddress

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-16 13:49:00 +03:00 committed by Leonard Lyubich
parent fdd123ad98
commit 95ccbbc2f9
4 changed files with 7 additions and 7 deletions

View file

@ -128,8 +128,8 @@ func multiaddrStringFromHostAddr(host string) (string, error) {
// IsLocalAddress returns true if network endpoint from local address
// source is equal to network endpoint of passed address.
func IsLocalAddress(src LocalAddressSource, addr *Address) bool {
return src.LocalAddress().Equal(*addr)
func IsLocalAddress(src LocalAddressSource, addr Address) bool {
return src.LocalAddress().Equal(addr)
}
// HostAddrFromMultiaddr converts "/dns4/localhost/tcp/8080" to "localhost:8080".

View file

@ -150,7 +150,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
var relay func(*network.Address) error
if p.relay != nil {
relay = func(addr *network.Address) error {
if network.IsLocalAddress(p.localAddrSrc, addr) {
if network.IsLocalAddress(p.localAddrSrc, *addr) {
return errLocalAddress
}
@ -167,7 +167,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
traverseOpts: prm.traverseOpts,
workerPool: p.workerPool,
nodeTargetInitializer: func(addr *network.Address) transformer.ObjectTarget {
if network.IsLocalAddress(p.localAddrSrc, addr) {
if network.IsLocalAddress(p.localAddrSrc, *addr) {
return &localTarget{
storage: p.localStore,
}

View file

@ -56,7 +56,7 @@ func (p *localPlacement) BuildPlacement(addr *object.Address, policy *netmapSDK.
continue
}
if network.IsLocalAddress(p.localAddrSrc, addr) {
if network.IsLocalAddress(p.localAddrSrc, *addr) {
return []netmapSDK.Nodes{{vs[i][j]}}, nil
}
}
@ -88,7 +88,7 @@ func (p *remotePlacement) BuildPlacement(addr *object.Address, policy *netmapSDK
continue
}
if network.IsLocalAddress(p.localAddrSrc, addr) {
if network.IsLocalAddress(p.localAddrSrc, *addr) {
vs[i] = append(vs[i][:j], vs[i][j+1:]...)
j--
}

View file

@ -68,7 +68,7 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes
continue
}
if network.IsLocalAddress(p.localAddrSrc, node) {
if network.IsLocalAddress(p.localAddrSrc, *node) {
if shortage == 0 {
// we can call the redundant copy callback
// here to slightly improve the performance