Browse Source

Check for subscribed multicast groups should be able to check groups bridged behind me.

Adam Ierymenko 10 years ago
parent
commit
758bf949db
2 changed files with 7 additions and 3 deletions
  1. 1 1
      node/Multicaster.cpp
  2. 6 2
      node/Network.hpp

+ 1 - 1
node/Multicaster.cpp

@@ -81,7 +81,7 @@ unsigned int Multicaster::gather(const Address &queryingPeer,uint64_t nwid,const
 
 	{ // Return myself if I am a member of this group
 		SharedPtr<Network> network(RR->node->network(nwid));
-		if ((network)&&(network->subscribedToMulticastGroup(mg))) {
+		if ((network)&&(network->subscribedToMulticastGroup(mg,true))) {
 			RR->identity.address().appendTo(appendTo);
 			++totalKnown;
 			++added;

+ 6 - 2
node/Network.hpp

@@ -116,10 +116,14 @@ public:
 	 * @param mg Multicast group
 	 * @return True if this network endpoint / peer is a member
 	 */
-	bool subscribedToMulticastGroup(const MulticastGroup &mg) const
+	bool subscribedToMulticastGroup(const MulticastGroup &mg,bool includeBridgedGroups) const
 	{
 		Mutex::Lock _l(_lock);
-		return (std::find(_myMulticastGroups.begin(),_myMulticastGroups.end(),mg) != _myMulticastGroups.end());
+		if (std::find(_myMulticastGroups.begin(),_myMulticastGroups.end(),mg) != _myMulticastGroups.end())
+			return true;
+		else if (includeBridgedGroups)
+			return (_multicastGroupsBehindMe.find(mg) != _multicastGroupsBehindMe.end());
+		else return false;
 	}
 
 	/**