summaryrefslogtreecommitdiff
path: root/node/Peer.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-01-27 13:50:56 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-01-27 13:50:56 -0800
commitf102fd7f92225fbe39ae69dda716530a4e5457e9 (patch)
tree87ca67ce754085992dd6de8b31858dd38b529750 /node/Peer.cpp
parent64774d0d4f552b2864abd969c6bc69c0ced3b2e1 (diff)
downloadinfinitytier-f102fd7f92225fbe39ae69dda716530a4e5457e9.tar.gz
infinitytier-f102fd7f92225fbe39ae69dda716530a4e5457e9.zip
Extend in-band world updates to handle moons too.
Diffstat (limited to 'node/Peer.cpp')
-rw-r--r--node/Peer.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp
index 40356034..441a5b33 100644
--- a/node/Peer.cpp
+++ b/node/Peer.cpp
@@ -345,6 +345,7 @@ SharedPtr<Path> Peer::getBestPath(uint64_t now,bool includeExpired)
void Peer::sendHELLO(const InetAddress &localAddr,const InetAddress &atAddress,uint64_t now)
{
Packet outp(_id.address(),RR->identity.address(),Packet::VERB_HELLO);
+
outp.append((unsigned char)ZT_PROTO_VERSION);
outp.append((unsigned char)ZEROTIER_ONE_VERSION_MAJOR);
outp.append((unsigned char)ZEROTIER_ONE_VERSION_MINOR);
@@ -352,8 +353,18 @@ void Peer::sendHELLO(const InetAddress &localAddr,const InetAddress &atAddress,u
outp.append(now);
RR->identity.serialize(outp,false);
atAddress.serialize(outp);
+
outp.append((uint64_t)RR->topology->planetWorldId());
outp.append((uint64_t)RR->topology->planetWorldTimestamp());
+
+ std::vector<World> moons(RR->topology->moons());
+ outp.append((uint16_t)moons.size());
+ for(std::vector<World>::const_iterator m(moons.begin());m!=moons.end();++m) {
+ outp.append((uint8_t)m->type());
+ outp.append((uint64_t)m->id());
+ outp.append((uint64_t)m->timestamp());
+ }
+
RR->node->expectReplyTo(outp.packetId());
outp.armor(_key,false); // HELLO is sent in the clear
RR->node->putPacket(localAddr,atAddress,outp.data(),outp.size());