Changeset 5668 for source/ariba/overlay
- Timestamp:
- Aug 4, 2009, 4:42:00 PM (15 years ago)
- Location:
- source/ariba/overlay/modules/chord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/modules/chord/Chord.cpp
r5666 r5668 116 116 } 117 117 118 void Chord::discover_neighbors( const LinkID& lnk ) { 119 { 120 // send successor discovery 121 ChordMessage cmsg(ChordMessage::discovery, nodeid, nodeid); 122 Discovery dmsg; 123 dmsg.setSourceEndpoint(&baseoverlay.getEndpointDescriptor()); 124 dmsg.setFollowType(Discovery::successor); 125 dmsg.setTTL((uint8_t)2); 126 cmsg.encapsulate(&dmsg); 127 send(&dmsg, lnk); 128 } 129 { 130 // send predecessor discovery 131 ChordMessage cmsg(ChordMessage::discovery, nodeid, nodeid); 132 Discovery dmsg; 133 dmsg.setSourceEndpoint(&baseoverlay.getEndpointDescriptor()); 134 dmsg.setFollowType(Discovery::predecessor); 135 dmsg.setTTL((uint8_t)2); 136 cmsg.encapsulate(&dmsg); 137 send(&dmsg, lnk); 138 } 139 } 140 141 118 142 void Chord::createOverlay() { 119 143 } … … 241 265 vector<LinkID>::iterator it = std::find(bootstrapLinks.begin(), bootstrapLinks.end(), lnk); 242 266 if( it != bootstrapLinks.end() ) { 243 // send discovery over bootstrap 244 Message msg; 245 ChordMessage cmsg(ChordMessage::discovery, nodeid, nodeid); 246 Discovery dmsg; 247 dmsg.setSourceEndpoint(&baseoverlay.getEndpointDescriptor()); 248 dmsg.setFollowType(Discovery::normal); 249 dmsg.setTTL((uint8_t) 4); 250 cmsg.encapsulate(&dmsg); 251 msg.encapsulate(&cmsg); 252 send(&msg, lnk); 267 discover_neighbors( lnk ); 253 268 bootstrapLinks.erase( it ); 254 269 } … … 366 381 } 367 382 368 383 // successor mode: follow the successor until TTL is zero 369 384 case Discovery::successor: 370 385 case Discovery::predecessor: { … … 435 450 const NodeID disc2 = table->get_finger_table(stabilize_finger).get_compare().get_center(); 436 451 send_discovery_to(disc1); 452 453 if (table->get_successor() != NULL) { 454 route_item* succ_item = table->get(*table->get_successor()); 455 discover_neighbors(succ_item->info); 456 } 457 458 // send predecessor message 459 if (table->get_predesessor() != NULL) { 460 route_item* pred_item = table->get(*table->get_predesessor()); 461 discover_neighbors(pred_item->info); 462 } 463 437 464 if (disc1 != disc2) 438 465 send_discovery_to(disc2); -
source/ariba/overlay/modules/chord/Chord.h
r5646 r5668 89 89 void send_discovery_to( const NodeID& destination, int ttl = 3 ); 90 90 91 void discover_neighbors( const LinkID& lnk ); 92 91 93 public: 92 94 Chord(BaseOverlay& _baseoverlay, const NodeID& _nodeid, … … 133 135 const LinkID& lnk = LinkID::UNSPECIFIED); 134 136 137 138 135 139 /// @see Timer.h 136 140 virtual void eventFunction();
Note:
See TracChangeset
for help on using the changeset viewer.