1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 03:12:44 +00:00

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.
This commit is contained in:
Juliusz Chroboczek 2011-02-15 19:10:56 +00:00
parent d591767941
commit 6cf281a311

View file

@ -230,15 +230,21 @@ dht_bootstrap(void *closure)
tr_free( bootstrap_file );
}
/* We really don't want to abuse our bootstrap nodes.
Be glacially slow. */
if(!bootstrap_done(cl->session, 0))
nap(30);
if(!bootstrap_done(cl->session, 0)) {
tr_ninf("DHT", "Attempting bootstrap from dht.transmissionbt.com");
bootstrap_from_name( "dht.transmissionbt.com", 6881,
bootstrap_af(session) );
for(i = 0; i < 6; i++) {
/* We don't want to abuse our bootstrap nodes, so be very
slow. The initial wait is to give other nodes a chance
to contact us before we attempt to contact a bootstrap
node, for example because we've just been restarted. */
nap(40);
if(bootstrap_done(cl->session, 0))
break;
if(i == 0)
tr_ninf("DHT",
"Attempting bootstrap from dht.transmissionbt.com");
bootstrap_from_name( "dht.transmissionbt.com", 6881,
bootstrap_af(session) );
}
}
if( cl->nodes )