Changeset 11893


Ignore:
Timestamp:
Feb 15, 2011, 7:10:56 PM (11 years ago)
Author:
jch
Message:

Make the initial DHT bootstrap more persistent.

We now try to contact the bootstrap nodes up to six times.
A better solution might be to reattempt bootstrap every half hour
or so. This might be beneficial to people whose connectivity
changes while Transmission is running.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tr-dht.c

    r11852 r11893  
    231231    }
    232232
    233     /* We really don't want to abuse our bootstrap nodes.
    234        Be glacially slow. */
    235     if(!bootstrap_done(cl->session, 0))
    236         nap(30);
    237 
    238233    if(!bootstrap_done(cl->session, 0)) {
    239         tr_ninf("DHT", "Attempting bootstrap from dht.transmissionbt.com");
    240         bootstrap_from_name( "dht.transmissionbt.com", 6881,
    241                              bootstrap_af(session) );
     234        for(i = 0; i < 6; i++) {
     235            /* We don't want to abuse our bootstrap nodes, so be very
     236               slow.  The initial wait is to give other nodes a chance
     237               to contact us before we attempt to contact a bootstrap
     238               node, for example because we've just been restarted. */
     239            nap(40);
     240            if(bootstrap_done(cl->session, 0))
     241                break;
     242            if(i == 0)
     243                tr_ninf("DHT",
     244                        "Attempting bootstrap from dht.transmissionbt.com");
     245            bootstrap_from_name( "dht.transmissionbt.com", 6881,
     246                                 bootstrap_af(session) );
     247        }
    242248    }
    243249
Note: See TracChangeset for help on using the changeset viewer.