mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/network: update underlay address in Kademlia.Register
This commit is contained in:
parent
ca2cad9ba4
commit
961302464d
1 changed files with 9 additions and 3 deletions
|
|
@ -155,11 +155,17 @@ func (k *Kademlia) Register(peers ...*BzzAddr) error {
|
|||
return newEntry(p)
|
||||
}
|
||||
|
||||
e, ok := v.(*entry)
|
||||
if ok {
|
||||
log.Trace("found among known peers, do nothing", "new", p, "old", e.BzzAddr)
|
||||
e := v.(*entry)
|
||||
|
||||
// if underlay address is different, still add
|
||||
if bytes.Compare(e.BzzAddr.UAddr, p.UAddr) != 0 {
|
||||
log.Trace("underlay addr is different, so add again", "new", p, "old", e.BzzAddr)
|
||||
// insert new offline peer into conns
|
||||
return newEntry(p)
|
||||
}
|
||||
|
||||
log.Trace("found among known peers, underlay addr is same, do nothing", "new", p, "old", e.BzzAddr)
|
||||
|
||||
return v
|
||||
})
|
||||
if found {
|
||||
|
|
|
|||
Loading…
Reference in a new issue