Changeset 5876 for source/ariba/overlay/modules/chord
- Timestamp:
- Aug 12, 2009, 12:04:09 AM (15 years ago)
- Location:
- source/ariba/overlay/modules/chord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/modules/chord/Chord.cpp
r5871 r5876 232 232 break; 233 233 } 234 /* 235 // check if we already have a connection, yes-> do not handle duplicate! 236 for (int i=0; i<table->size(); i++) 237 if ((*table)[i]->id == remote && !((*table)[i]->info.isUnspecified()) && (*table)[i]->info != lnk) { 238 239 return; 240 } 241 */ 234 242 235 if (remote==nodeid) { 243 236 baseoverlay.dropLink(lnk); … … 305 298 ); 306 299 300 // add discovery node id 301 bool found = false; 302 BOOST_FOREACH( NodeID& value, discovery ) 303 if (value == m->getSourceNode()) { 304 found = true; 305 break; 306 } 307 if (!found) discovery.push_back(m->getSourceNode()); 308 307 309 // check if source node can be added to routing table and setup link 308 if (m->getSourceNode() != nodeid 309 && table->is_insertable(m->getSourceNode())) 310 if (m->getSourceNode() != nodeid) 310 311 setup( dmsg->getEndpoint(), m->getSourceNode() ); 311 312 … … 317 318 // closest node? yes-> split to follow successor and predecessor 318 319 if ( table->is_closest_to(m->getDestinationNode()) ) { 319 320 if ( table->get_successor() != NULL) {320 logging_debug("Discovery split:"); 321 if (!table->get_successor()->isUnspecified()) { 321 322 OverlayMsg omsg(*m); 322 323 dmsg->setType(Discovery::successor); 323 324 omsg.encapsulate(dmsg); 324 route_item* succ_item = table->get(*table->get_successor()); 325 logging_debug("Discovery split: routing discovery message to successor " 326 << succ_item->id.toString() ); 327 send(&omsg, succ_item->info); 325 logging_debug("* Routing to successor " 326 << table->get_successor()->toString() ); 327 baseoverlay.send( &omsg, *table->get_successor() ); 328 328 } 329 329 330 330 // send predecessor message 331 if ( table->get_predesessor() != NULL) {331 if (!table->get_predesessor()->isUnspecified()) { 332 332 OverlayMsg omsg(*m); 333 333 dmsg->setType(Discovery::predecessor); 334 334 omsg.encapsulate(dmsg); 335 route_item* pred_item = table->get( 336 *table->get_predesessor()); 337 logging_debug("Discovery split: routing discovery message to predecessor " 338 << pred_item->id.toString() ); 339 send( &omsg, pred_item->info); 335 logging_debug("* Routing to predecessor " 336 << table->get_predesessor()->toString() ); 337 baseoverlay.send( &omsg, *table->get_predesessor() ); 340 338 } 341 339 } … … 365 363 } 366 364 if (item == NULL) break; 367 logging_debug(" routing discovery message to succ/pred "365 logging_debug("Routing discovery message to succ/pred " 368 366 << item->id.toString() ); 369 367 OverlayMsg omsg(*m); 370 368 omsg.encapsulate(dmsg); 371 369 omsg.setDestinationNode(item->id); 370 omsg.setService(OverlayInterface::OVERLAY_SERVICE_ID); 371 omsg.setRelayed(true); 372 372 baseoverlay.send(&omsg, omsg.getDestinationNode()); 373 373 break; … … 407 407 logging_info("Running stabilization: #links=" 408 408 << table->size() << " #neighbors=" << numNeighbors ); 409 410 // updating neighbors 411 for (int i=0; i<table->size(); i++) { 412 LinkID id = (*table)[i]->info; 413 if (!id.isUnspecified()) discover_neighbors(id); 414 } 409 415 410 416 // sending discovery … … 417 423 send_discovery_to(disc2); 418 424 419 for (int i=0; i<table->size(); i++) {420 LinkID id = (*table)[i]->info;421 if (!id.isUnspecified()) discover_neighbors(id);422 }423 425 424 426 // remove orphan links 425 427 orphan_removal_counter++; 426 428 if (orphan_removal_counter <0 || orphan_removal_counter >= 2) { 429 logging_info("Discovered nodes: "); 430 BOOST_FOREACH( NodeID& id, discovery ) 431 logging_info("* " << id.toString()); 432 discovery.clear(); 427 433 logging_info("Running orphan removal"); 428 434 orphan_removal_counter = 0; -
source/ariba/overlay/modules/chord/Chord.h
r5870 r5876 80 80 vector<LinkID> bootstrapLinks; 81 81 vector<NodeID> pending; 82 vector<NodeID> discovery; 82 83 int discovery_count; 83 84
Note:
See TracChangeset
for help on using the changeset viewer.