Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1732 from weaveworks/1731-merge-peer-has-short-id
Browse files Browse the repository at this point in the history
update Peer.HasShortID as part of topology merge
Fixes #1731
  • Loading branch information
bboreham committed Nov 30, 2015
2 parents 4420057 + 9dee2f2 commit 74fdf6b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mesh/peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,16 +476,20 @@ func (peers *Peers) applyUpdate(decodedUpdate []*Peer, decodedConns [][]Connecti
newUpdate[name] = void
default: // existing peer
if newPeer.Version < peer.Version ||
(newPeer.Version == peer.Version && newPeer.UID <= peer.UID) {
(newPeer.Version == peer.Version &&
(newPeer.UID < peer.UID ||
(newPeer.UID == peer.UID &&
(!newPeer.HasShortID || peer.HasShortID)))) {
continue
}
peer.Version = newPeer.Version
peer.UID = newPeer.UID
peer.connections = makeConnsMap(peer, connSummaries, peers.byName)

if newPeer.ShortID != peer.ShortID {
if newPeer.ShortID != peer.ShortID || newPeer.HasShortID != peer.HasShortID {
peers.deleteByShortID(peer, pending)
peer.ShortID = newPeer.ShortID
peer.HasShortID = newPeer.HasShortID
peers.addByShortID(peer, pending)
}
newUpdate[name] = void
Expand Down

0 comments on commit 74fdf6b

Please sign in to comment.