Index: source/ariba/SideportListener.cpp
===================================================================
--- source/ariba/SideportListener.cpp	(revision 5539)
+++ source/ariba/SideportListener.cpp	(revision 5540)
@@ -87,5 +87,5 @@
 
 	BOOST_FOREACH( LinkDescriptor* link, overlay->links ){
-		if( (!link->localRelay.isUnspecified()) && link->remoteRelay == node && link->up)
+		if( link->relay && link->remoteNode == node && link->up)
 			return true;
 	}
@@ -98,5 +98,5 @@
 
 	BOOST_FOREACH( LinkDescriptor* link, overlay->links ){
-		if( (!link->localRelay.isUnspecified()) && link->localRelay == node && link->up)
+		if( link->relay && link->localRelay == node && link->up)
 			return true;
 	}
@@ -111,31 +111,28 @@
 	using namespace ariba::addressing;
 
-	BOOST_FOREACH( LinkDescriptor* link, overlay->links ){
-		if(link->remoteNode == node){
-			if(overlay->bc == NULL) continue;
+	LinkDescriptor* link = overlay->getSendDescriptor(node);
+	if (link==NULL) return (Protocol)ret;
 
-			BaseCommunication::LinkDescriptor& bclink =
-				overlay->bc->queryLocalLink(link->communicationId);
+	BaseCommunication::LinkDescriptor& bclink =
+		overlay->bc->queryLocalLink(link->communicationId);
 
-			if(bclink.isUnspecified()) continue;
-			if(bclink.localLocator == NULL) continue;
+	if(bclink.isUnspecified()) return (Protocol)ret;
+	if(bclink.localLocator == NULL) return (Protocol)ret;
 
-			const address_v* locator = bclink.remoteLocator;
+	const address_v* locator = bclink.remoteLocator;
 
-			if( locator->instanceof<tcpip_endpoint>() ){
+	if( locator->instanceof<tcpip_endpoint>() ){
 
-				tcpip_endpoint tcpip = *locator;
-				ret |= SideportListener::tcp;
+		tcpip_endpoint tcpip = *locator;
+		ret |= SideportListener::tcp;
 
-				if( tcpip.address().is_v4() )
-					ret |= SideportListener::ipv4;
+		if( tcpip.address().is_v4() )
+			ret |= SideportListener::ipv4;
 
-				if( tcpip.address().is_v6() )
-					ret |= SideportListener::ipv6;
+		if( tcpip.address().is_v6() )
+			ret |= SideportListener::ipv6;
 
-			}else if( locator->instanceof<rfcomm_endpoint>() ){
-				ret |= SideportListener::rfcomm;
-			}
-		}
+	}else if( locator->instanceof<rfcomm_endpoint>() ){
+		ret |= SideportListener::rfcomm;
 	}
 
