Changeset 6961 for source


Ignore:
Timestamp:
Nov 18, 2009, 9:44:28 PM (14 years ago)
Author:
mies
Message:
 
Location:
source/ariba/overlay
Files:
3 edited

Legend:

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

    r6953 r6961  
    360360                if (!ld->up) continue;
    361361
     362                // check if link is relayed and retry connecting directly
     363                if ( ld->relayed && ld->retryCounter > 0) {
     364                        ld->retryCounter--;
     365                        ld->communicationId = bc->establishLink( ld->endpoint );
     366                }
     367
    362368                // remote used as relay flag
    363369                if ( ld->relaying && difftime( now, ld->timeRelaying ) > 10)
     
    756762                        sideport(&SideportListener::DEFAULT), overlayInterface(NULL),
    757763                        counter(0) {
    758         dht = new DHT();
    759         localDHT = new DHT();
     764        initDHT();
    760765}
    761766
    762767BaseOverlay::~BaseOverlay() {
    763         delete dht;
     768        destroyDHT();
    764769}
    765770
     
    17551760
    17561761        // try to replace relay link with direct link
    1757         ldn->communicationId =
    1758                         bc->establishLink( overlayMsg->getSourceEndpoint() );
     1762        ldn->retryCounter = 3;
     1763        ldn->endpoint = overlayMsg->getSourceEndpoint();
     1764        ldn->communicationId =  bc->establishLink( ldn->endpoint );
    17591765
    17601766        return true;
     
    20962102// ----------------------------------------------------------------------------
    20972103
     2104void BaseOverlay::initDHT() {
     2105        dht = new DHT();
     2106        localDHT = new DHT();
     2107        republishCounter = 0;
     2108}
     2109
     2110void BaseOverlay::destroyDHT() {
     2111        delete dht;
     2112        delete localDHT;
     2113}
     2114
    20982115/// stabilize DHT state
    20992116void BaseOverlay::stabilizeDHT() {
     2117
     2118        // do not refresh every second
     2119        if (republishCounter < 2) {
     2120                republishCounter++;
     2121                return;
     2122        }
     2123        republishCounter = 0;
     2124
    21002125        // remove old values from DHT
    21012126        BOOST_FOREACH( DHTEntry& entry, dht->entries ) {
  • source/ariba/overlay/BaseOverlay.h

    r6874 r6961  
    500500        DHT* dht;
    501501        DHT* localDHT;
    502 
     502        int republishCounter;
     503
     504        void initDHT();
     505        void destroyDHT();
    503506        void stabilizeDHT();
    504507        void dhtSend( OverlayMsg* msg, const NodeID& dest );
  • source/ariba/overlay/LinkDescriptor.h

    r5916 r6961  
    1010#include "ariba/utility/messages.h"
    1111#include "ariba/utility/types.h"
     12#include "ariba/communication/EndpointDescriptor.h"
    1213#include "ariba/CommunicationListener.h"
    1314
     
    2324using ariba::utility::LinkID;
    2425using ariba::CommunicationListener;
     26using ariba::communication::EndpointDescriptor;
    2527
    2628namespace ariba {
     
    5557                this->autolink = false;
    5658                this->lastuse = time(NULL);
     59                this->retryCounter = 0;
    5760        }
    5861
     
    7881        LinkID communicationId; ///< the communication id
    7982        bool   communicationUp;   ///< flag, whether the communication is up
     83
     84        // direct link retries -----------------------------------------------------
     85        EndpointDescriptor endpoint;
     86        int retryCounter;
    8087
    8188        // link alive information --------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.