Changeset 5876


Ignore:
Timestamp:
Aug 12, 2009, 12:04:09 AM (15 years ago)
Author:
mies
Message:
 
Location:
source/ariba
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/overlay/BaseOverlay.cpp

    r5871 r5876  
    211211}
    212212
     213/// shows the current link state
    213214void BaseOverlay::showLinks() {
    214215        int i=0;
     
    220221        logging_info("----------------------------------------------");
    221222}
     223
     224/// compares two arbitrary links to the same node
     225int BaseOverlay::compare( const LinkID& lhs, const LinkID& rhs ) {
     226        LinkDescriptor* lhsld = getDescriptor(lhs);
     227        LinkDescriptor* rhsld = getDescriptor(rhs);
     228        if (lhsld==NULL || rhsld==NULL
     229                || !lhsld->up || !rhsld->up
     230                || lhsld->remoteNode != rhsld->remoteNode) return -1;
     231
     232        if ((lhsld->remoteLink^lhsld->overlayId)<(rhsld->remoteLink^lhsld->overlayId)  )
     233                return -1;
     234
     235        return 1;
     236}
     237
    222238
    223239// internal message delivery ---------------------------------------------------
  • source/ariba/overlay/BaseOverlay.h

    r5870 r5876  
    434434        void showLinks();
    435435
     436        /// compares two arbitrary links to the same node
     437        int compare( const LinkID& lhs, const LinkID& rhs );
     438
    436439        // relay route management --------------------------------------------------
    437440
  • source/ariba/overlay/modules/chord/Chord.cpp

    r5871 r5876  
    232232                        break;
    233233                }
    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
    242235        if (remote==nodeid) {
    243236                baseoverlay.dropLink(lnk);
     
    305298                );
    306299
     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
    307309                // 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)
    310311                        setup( dmsg->getEndpoint(), m->getSourceNode() );
    311312
     
    317318                        // closest node? yes-> split to follow successor and predecessor
    318319                        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()) {
    321322                                        OverlayMsg omsg(*m);
    322323                                        dmsg->setType(Discovery::successor);
    323324                                        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() );
    328328                                }
    329329
    330330                                // send predecessor message
    331                                 if (table->get_predesessor() != NULL) {
     331                                if (!table->get_predesessor()->isUnspecified()) {
    332332                                        OverlayMsg omsg(*m);
    333333                                        dmsg->setType(Discovery::predecessor);
    334334                                        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() );
    340338                                }
    341339                        }
     
    365363                        }
    366364                        if (item == NULL) break;
    367                         logging_debug("routing discovery message to succ/pred "
     365                        logging_debug("Routing discovery message to succ/pred "
    368366                                << item->id.toString() );
    369367                        OverlayMsg omsg(*m);
    370368                        omsg.encapsulate(dmsg);
    371369                        omsg.setDestinationNode(item->id);
     370                        omsg.setService(OverlayInterface::OVERLAY_SERVICE_ID);
     371                        omsg.setRelayed(true);
    372372                        baseoverlay.send(&omsg, omsg.getDestinationNode());
    373373                        break;
     
    407407                logging_info("Running stabilization: #links="
    408408                                << 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                }
    409415
    410416                // sending discovery
     
    417423                        send_discovery_to(disc2);
    418424
    419                 for (int i=0; i<table->size(); i++) {
    420                         LinkID id = (*table)[i]->info;
    421                         if (!id.isUnspecified()) discover_neighbors(id);
    422                 }
    423425
    424426                // remove orphan links
    425427                orphan_removal_counter++;
    426428                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();
    427433                        logging_info("Running orphan removal");
    428434                        orphan_removal_counter = 0;
  • source/ariba/overlay/modules/chord/Chord.h

    r5870 r5876  
    8080        vector<LinkID> bootstrapLinks;
    8181        vector<NodeID> pending;
     82        vector<NodeID> discovery;
    8283        int discovery_count;
    8384
  • source/ariba/utility/transport/tcpip/protlib/address.cpp

    r5284 r5876  
    431431                // Otherwise they are not equal.
    432432                if (hostaddress::operator==(ie)) {
    433                     if (proto!=app->proto) cout << "protocols not matching" << endl;
    434                     if (port !=app->port) cout << "ports not matching" << endl;
     433                    //if (proto!=app->proto) cout << "protocols not matching" << endl;
     434                    //if (port !=app->port) cout << "ports not matching" << endl;
    435435
    436436                    return ((proto==app->proto) && (port==app->port));
Note: See TracChangeset for help on using the changeset viewer.