Improve OverlayLink publication

This commit is contained in:
Tony Garnock-Jones 2019-05-28 16:54:58 +01:00
parent 08a8d51de6
commit 7f07be80df
1 changed files with 4 additions and 4 deletions

View File

@ -35,6 +35,7 @@ const fs = require('fs');
spawn named 'peerAdvertisement' {
const localId = RandomID.randomId(8, false);
assert OverlayNode(localId);
console.log('Local node ID is', localId);
during Federation.ManagementScope($managementScope) {
during P.Envelope(managementScope, Overlay($overlayId, _)) {
@ -135,10 +136,10 @@ spawn named 'uplinkSelection' {
this.peers.forEach((p) => { if (better(p)) best = p; });
if (best && (best.get(1) !== localId)) {
this.bestAddr = best.get(3);
this.bestPeer = best;
this.bestPeer = OverlayNode(best.get(1));
} else {
this.bestAddr = rootAddr;
this.bestPeer = null;
this.bestPeer = OverlayRoot();
}
}
@ -149,8 +150,7 @@ spawn named 'uplinkSelection' {
assert P.Proposal(managementScope, Federation.Uplink(overlayId, this.bestAddr, overlayId))
when (this.bestAddr);
assert P.Proposal(overlayId, OverlayLink(OverlayNode(localId),
this.bestPeer || OverlayRoot()))
assert P.Proposal(overlayId, OverlayLink(OverlayNode(localId), this.bestPeer))
when (this.bestAddr);
}
}