Ignore:
Timestamp:
Nov 18, 2009, 9:44:28 PM (14 years ago)
Author:
mies
Message:
 
File:
1 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 ) {
Note: See TracChangeset for help on using the changeset viewer.