forked from TrueCloudLab/frostfs-node
[#607] network: Accept value instead of pointer in IsLocalAddress
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>support/v0.27
parent
fdd123ad98
commit
95ccbbc2f9
|
@ -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".
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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--
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue