Adam Ierymenko 12 years ago
parent
commit
b8e9a79d00
3 changed files with 17 additions and 3 deletions
  1. 10 1
      node/Multicaster.hpp
  2. 6 1
      node/NodeConfig.cpp
  3. 1 1
      node/Packet.hpp

+ 10 - 1
node/Multicaster.hpp

@@ -261,7 +261,16 @@ public:
 			bf.set((peers[chosen++] = *i)->address().sum());
 			bf.set((peers[chosen++] = *i)->address().sum());
 
 
 		// Add a supernode if there are fewer than the desired
 		// Add a supernode if there are fewer than the desired
-		// number of recipients.
+		// number of recipients. Note that we do not use the bloom
+		// filter to track visits to supernodes, intentionally
+		// allowing multicasts to ping pong between supernodes.
+		// Supernodes propagate even messages they've already seen,
+		// while regular nodes do not. Thus this ping-ponging will
+		// cause the supernodes to pick new starting points for
+		// peer to peer graph traversal multiple times. It's a
+		// simple, stateless way to increase supernode-driven
+		// propagation of a multicast in the event that peer to
+		// peer connectivity for its group is sparse.
 		if (chosen < max) {
 		if (chosen < max) {
 			Address avoid[2];
 			Address avoid[2];
 			avoid[0] = originalSubmitter;
 			avoid[0] = originalSubmitter;

+ 6 - 1
node/NodeConfig.cpp

@@ -219,12 +219,17 @@ bool NodeConfig::decodeControlMessagePacket(const void *key,const void *data,uns
 void NodeConfig::_CBcontrolPacketHandler(UdpSocket *sock,void *arg,const InetAddress &remoteAddr,const void *data,unsigned int len)
 void NodeConfig::_CBcontrolPacketHandler(UdpSocket *sock,void *arg,const InetAddress &remoteAddr,const void *data,unsigned int len)
 {
 {
 	NodeConfig *nc = (NodeConfig *)arg;
 	NodeConfig *nc = (NodeConfig *)arg;
+	const RuntimeEnvironment *_r = nc->_r;
+
 	try {
 	try {
 		unsigned long convId = 0;
 		unsigned long convId = 0;
 		std::vector<std::string> commands;
 		std::vector<std::string> commands;
 
 
-		if (!decodeControlMessagePacket(nc->_controlSocketKey,data,len,convId,commands))
+		if (!decodeControlMessagePacket(nc->_controlSocketKey,data,len,convId,commands)) {
+			TRACE("control bus packet from %s failed decode, discarded",remoteAddr.toString().c_str());
 			return;
 			return;
+		}
+		TRACE("control bus packet from %s, contains %d commands",remoteAddr.toString().c_str(),(int)commands.size());
 
 
 		for(std::vector<std::string>::iterator c(commands.begin());c!=commands.end();++c) {
 		for(std::vector<std::string>::iterator c(commands.begin());c!=commands.end();++c) {
 			std::vector< Buffer<ZT_NODECONFIG_MAX_PACKET_SIZE> > resultPackets(encodeControlMessage(nc->_controlSocketKey,convId,nc->execute(c->c_str())));
 			std::vector< Buffer<ZT_NODECONFIG_MAX_PACKET_SIZE> > resultPackets(encodeControlMessage(nc->_controlSocketKey,convId,nc->execute(c->c_str())));

+ 1 - 1
node/Packet.hpp

@@ -449,7 +449,7 @@ public:
 		 *   <[2] 16-bit length of payload>
 		 *   <[2] 16-bit length of payload>
 		 *   <[2] 16-bit length of signature>
 		 *   <[2] 16-bit length of signature>
 		 *   <[...] ethernet payload>
 		 *   <[...] ethernet payload>
-		 *   <[...] ECDSA signature>
+		 *   <[...] ECDSA signature of SHA-256 hash (see below)>
 		 *
 		 *
 		 * The signature is made using the key of the original submitter, and
 		 * The signature is made using the key of the original submitter, and
 		 * can be used to authenticate the submitter for security and rate
 		 * can be used to authenticate the submitter for security and rate