瀏覽代碼

Send COM with MULTICAST_GATHER for future use.

Adam Ierymenko 10 年之前
父節點
當前提交
6693149f3e
共有 1 個文件被更改,包括 14 次插入1 次删除
  1. 14 1
      node/Multicaster.cpp

+ 14 - 1
node/Multicaster.cpp

@@ -237,12 +237,25 @@ void Multicaster::send(
 			if (sn) {
 				TRACE(">>MC upstream GATHER up to %u for group %.16llx/%s",gatherLimit,nwid,mg.toString().c_str());
 
+				const CertificateOfMembership *com = (CertificateOfMembership *)0;
+				if (sn->needsOurNetworkMembershipCertificate(nwid,now,true)) {
+					SharedPtr<Network> nw = RR->node->network(nwid);
+					SharedPtr<NetworkConfig> nconf;
+					if (nw) {
+						nconf = nw->config2();
+						if (nconf)
+							com = &(nconf->com());
+					}
+				}
+
 				Packet outp(sn->address(),RR->identity.address(),Packet::VERB_MULTICAST_GATHER);
 				outp.append(nwid);
-				outp.append((uint8_t)0);
+				outp.append((uint8_t)(com ? 0x01 : 0x00));
 				mg.mac().appendTo(outp);
 				outp.append((uint32_t)mg.adi());
 				outp.append((uint32_t)gatherLimit);
+				if (com)
+					com->serialize(outp);
 				outp.armor(sn->key(),true);
 				sn->send(RR,outp.data(),outp.size(),now);
 			}