Changeset 5916


Ignore:
Timestamp:
Aug 13, 2009, 1:26:27 PM (15 years ago)
Author:
mies
Message:
 
Location:
source/ariba/overlay
Files:
3 edited

Legend:

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

    r5912 r5916  
    201201}
    202202
     203
     204std::string BaseOverlay::getLinkHTMLInfo() {
     205        std::ostringstream s;
     206
     207        s << "<h2 color=\"#606060\">Links</h2>";
     208        s << "<table cellpadding=\"0\" border=\"0\" cellspacing=\"0\">";
     209        s << "<tr background=\"#e0e0e0\">";
     210        s << "<td>Id</td><td>Remote</td><td>Path</td>";
     211        s << "</tr>";
     212
     213        BOOST_FOREACH( LinkDescriptor* ld, links ) {
     214                if (!ld->isVital() || ld->service != OverlayInterface::OVERLAY_SERVICE_ID) continue;
     215                s << "<tr>";
     216                s << "<td>" << ld->overlayId.toString().substr(0,4) << "..</td>";
     217                s << "<td>" << ld->remoteNode.toString().substr(0,4) << "..</td>";
     218                s << "<td>";
     219                if (ld->routeRecord.size()>0) {
     220                        for (size_t i=0; i<ld->routeRecord.size(); i++)
     221                                s << ld->routeRecord[i].toString().substr(0,4) << ".. ";
     222                }
     223                s << "</td>";
     224                s << "</tr>";
     225        }
     226        s << "</table>";
     227
     228        return s.str();
     229}
     230
    203231/// shows the current link state
    204232void BaseOverlay::showLinks() {
     
    278306                        return bc->sendMessage(next_link->communicationId, message);
    279307                } else {
    280                         logging_error("Could not send message. No relay hop found to "
     308                        logging_warn("Could not send message. No relay hop found to "
    281309                                        << destination)
    282310                        return -1;
     
    289317                LinkID next_id = overlayInterface->getNextLinkId( destination );
    290318                if (next_id.isUnspecified()) {
    291                         logging_error("Could not send message. No next hop found to " <<
     319                        logging_warn("Could not send message. No next hop found to " <<
    292320                                destination );
    293321                        return -1;
     
    303331                // no-> error, dropping message
    304332                else {
    305                         logging_error("Could not send message. Link not known or up");
     333                        logging_warn("Could not send message. Link not known or up");
    306334                        return -1;
    307335                }
     
    386414                relay_route& route = *i;
    387415                LinkDescriptor* ld = getDescriptor(route.link);
     416
     417                // relay link still used and alive?
    388418                if (ld==NULL
    389                         || !ld->up
    390                         || ld->keepAliveMissed != 0
    391                         || !ld->communicationUp
    392                         || difftime(route.used, time(NULL)) > 4) {
     419                        || !ld->isDirectVital()
     420                        || difftime(route.used, time(NULL)) > 8) {
    393421                        logging_info("Forgetting relay information to node "
    394422                                        << route.node.toString() );
     
    449477                                // refresh timer
    450478                                route.used = time(NULL);
    451 
    452                                 // route has a shorter hop count? yes-> replace
    453                                 if (route.hops > message->getNumHops() ) {
     479                                LinkDescriptor* rld = getDescriptor(route.link);
     480
     481                                // route has a shorter hop count or old link is dead? yes-> replace
     482                                if (route.hops > message->getNumHops()
     483                                        || rld == NULL
     484                                        || !rld->isDirectVital()) {
    454485                                        logging_info("Updating relay information to node "
    455486                                                << route.node.toString()
     
    480511                if (route.node == remote ) {
    481512                        LinkDescriptor* ld = getDescriptor( route.link );
    482                         if (ld==NULL || !ld->up || !ld->communicationUp) return NULL; else {
     513                        if (ld==NULL || !ld->isDirectVital()) return NULL; else {
    483514                                route.used = time(NULL);
    484515                                return ld;
  • source/ariba/overlay/BaseOverlay.h

    r5882 r5916  
    347347        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    348348
     349        std::string getLinkHTMLInfo();
    349350
    350351private:
  • source/ariba/overlay/LinkDescriptor.h

    r5873 r5916  
    6666        bool fromRemote;   ///< flag, whether this link was requested from remote
    6767        NodeID remoteNode; ///< remote end-point node
     68        bool isVital() {
     69                return up && keepAliveMissed == 0;
     70        }
     71        bool isDirectVital() {
     72                return isVital() && communicationUp && !relayed;
     73        }
     74
    6875
    6976        // link identifiers --------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.