Browse Source

Bug fix in multicast changes.

Adam Ierymenko 12 years ago
parent
commit
a0a9d52213
1 changed files with 6 additions and 3 deletions
  1. 6 3
      node/Multicaster.hpp

+ 6 - 3
node/Multicaster.hpp

@@ -251,8 +251,9 @@ public:
 					if (peer) {
 					if (peer) {
 						unsigned int chk = 0;
 						unsigned int chk = 0;
 						while (chk < chosen) {
 						while (chk < chosen) {
-							if (peers[chk++] == peer)
+							if (peers[chk] == peer)
 								break;
 								break;
+							++chk;
 						}
 						}
 						if (chk == chosen) { /* not already picked */
 						if (chk == chosen) { /* not already picked */
 							peers[chosen++] = peer;
 							peers[chosen++] = peer;
@@ -262,7 +263,7 @@ public:
 				}
 				}
 			}
 			}
 		}
 		}
-		return 0;
+		return chosen;
 	}
 	}
 
 
 	/**
 	/**
@@ -327,7 +328,9 @@ public:
 
 
 		/* Tack on a supernode if we have no next hops */
 		/* Tack on a supernode if we have no next hops */
 		if (!chosen) {
 		if (!chosen) {
-			P peer = topology.getBestSupernode();
+			Address exclude[1];
+			exclude[0] = originalSubmitter; // if it came from a supernode, don't boomerang
+			P peer = topology.getBestSupernode(exclude,1,true);
 			if (peer)
 			if (peer)
 				peers[chosen++] = peer;
 				peers[chosen++] = peer;
 		}
 		}