Changeset 5481 for source/ariba/overlay
- Timestamp:
- Jul 30, 2009, 1:06:58 PM (15 years ago)
- Location:
- source/ariba/overlay
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/BaseOverlay.cpp
r5464 r5481 114 114 115 115 /// find a proper relay node 116 const NodeID BaseOverlay::findRelayNode( const NodeID &id ) {116 const NodeID BaseOverlay::findRelayNode( const NodeID id ) { 117 117 LinkDescriptor* rld = NULL; 118 118 NodeID relayNode = NodeID::UNSPECIFIED; … … 133 133 else relayNode = rld->remoteNode; 134 134 } 135 logging_force( "Potential relay node " << relayNode.toString() ); 135 136 // if first relay is unknown choose a arbitrary direct node as relay 137 if ( relayNode.isUnspecified() ) { 138 for (size_t i=0; i<links.size(); i++) 139 if (links[i]->up && 140 links[i]->communicationUp && 141 !links[i]->relay && 142 links[i]->keepAliveMissed <= 1 && 143 links[i]->service == OverlayInterface::OVERLAY_SERVICE_ID) { 144 relayNode = links[i]->remoteNode; 145 break; 146 } 147 } 148 136 149 // do not return myself or use the node as relay node 137 150 if (relayNode == nodeId) … … 189 202 } 190 203 204 /// routes a message over the overlay or directly sends it when a link is open 205 seqnum_t BaseOverlay::sendOverlay( Message* message, const NodeID& nodeid ) { 206 for (size_t i=0; i<links.size(); i++) 207 if ( links[i]->up && 208 links[i]->communicationUp && 209 !links[i]->relay && 210 links[i]->keepAliveMissed <= 1 && 211 links[i]->remoteNode == nodeid && 212 links[i]->service == OverlayInterface::OVERLAY_SERVICE_ID) { 213 return sendMessage( message, links[i] ); 214 break; 215 } 216 overlayInterface->routeMessage(nodeid, message); 217 return 0; 218 } 219 191 220 /// creates a link descriptor, apply relay semantics if possible 192 221 LinkDescriptor* BaseOverlay::createLinkDescriptor( 193 const NodeID & remoteNode, const ServiceID& service, const LinkID&link_id ) {222 const NodeID remoteNode, const ServiceID service, const LinkID link_id ) { 194 223 195 224 // find listener … … 1321 1350 if (relayMsg->getRelayNode() == nodeId || relayMsg->getRelayNode().isUnspecified()) { 1322 1351 logging_info("Routing relay message to " << relayMsg->getDestNode().toString() ); 1323 overlayInterface->routeMessage(relayMsg->getDestNode(), &_overMsg);1352 sendOverlay( &_overMsg, relayMsg->getDestNode() ); 1324 1353 } else { 1325 1354 logging_info("Routing relay message to " << relayMsg->getRelayNode().toString() ); 1326 overlayInterface->routeMessage(relayMsg->getRelayNode(), &_overMsg);1355 sendOverlay( &_overMsg, relayMsg->getRelayNode() ); 1327 1356 } 1328 1357 return true; … … 1354 1383 1355 1384 /// this must be handled by using relay link! 1356 overlayInterface->routeMessage(relayMsg->getDestNode(), &_overMsg);1385 sendOverlay(&_overMsg, relayMsg->getDestNode()); 1357 1386 return true; 1358 1387 } -
source/ariba/overlay/BaseOverlay.h
r5316 r5481 415 415 416 416 /// find a proper relay node that is directly connected to this node 417 const NodeID findRelayNode( const NodeID &id );417 const NodeID findRelayNode( const NodeID id ); 418 418 419 419 /// forwards a message over relays/overlay/directly using link descriptor 420 420 seqnum_t sendMessage( Message* message, const LinkDescriptor* ld ); 421 421 422 /// routes a message over the overlay or directly sends it when a link is open 423 seqnum_t sendOverlay( Message* message, const NodeID& nodeid ); 424 422 425 /// creates a link descriptor, applys relay semantics if possible 423 426 LinkDescriptor* createLinkDescriptor( 424 const NodeID & remoteNode, const ServiceID& service, const LinkID&link_id );427 const NodeID remoteNode, const ServiceID service, const LinkID link_id ); 425 428 426 429 // map of a link request map a nonce to a LinkID
Note:
See TracChangeset
for help on using the changeset viewer.