(trunk libT) experimental code to get more peers faster
This commit is contained in:
parent
d4010f4abd
commit
78cf80d3c0
|
@ -61,11 +61,11 @@ enum
|
||||||
BANDWIDTH_PERIOD_MSEC = 500,
|
BANDWIDTH_PERIOD_MSEC = 500,
|
||||||
|
|
||||||
/* max # of peers to ask fer per torrent per reconnect pulse */
|
/* max # of peers to ask fer per torrent per reconnect pulse */
|
||||||
MAX_RECONNECTIONS_PER_PULSE = 4,
|
MAX_RECONNECTIONS_PER_PULSE = 16,
|
||||||
|
|
||||||
/* max number of peers to ask for per second overall.
|
/* max number of peers to ask for per second overall.
|
||||||
* this throttle is to avoid overloading the router */
|
* this throttle is to avoid overloading the router */
|
||||||
MAX_CONNECTIONS_PER_SECOND = 8,
|
MAX_CONNECTIONS_PER_SECOND = 32,
|
||||||
|
|
||||||
/* number of unchoked peers per torrent.
|
/* number of unchoked peers per torrent.
|
||||||
* FIXME: this probably ought to be configurable */
|
* FIXME: this probably ought to be configurable */
|
||||||
|
@ -1175,7 +1175,7 @@ getMaxPeerCount( const tr_torrent * tor )
|
||||||
static int
|
static int
|
||||||
getPeerCount( const Torrent * t )
|
getPeerCount( const Torrent * t )
|
||||||
{
|
{
|
||||||
return tr_ptrArraySize( &t->peers ) + tr_ptrArraySize( &t->outgoingHandshakes );
|
return tr_ptrArraySize( &t->peers );// + tr_ptrArraySize( &t->outgoingHandshakes );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: this is kind of a mess. */
|
/* FIXME: this is kind of a mess. */
|
||||||
|
@ -2274,7 +2274,7 @@ reconnectPulse( void * vtorrent )
|
||||||
struct peer_atom ** candidates = getPeerCandidates( t, &nCandidates );
|
struct peer_atom ** candidates = getPeerCandidates( t, &nCandidates );
|
||||||
struct tr_peer ** connections = getPeersToClose( t, &nBad );
|
struct tr_peer ** connections = getPeersToClose( t, &nBad );
|
||||||
|
|
||||||
if( nBad || nCandidates )
|
//if( nBad || nCandidates )
|
||||||
tordbg( t, "reconnect pulse for [%s]: %d bad connections, "
|
tordbg( t, "reconnect pulse for [%s]: %d bad connections, "
|
||||||
"%d connection candidates, %d atoms, max per pulse is %d",
|
"%d connection candidates, %d atoms, max per pulse is %d",
|
||||||
t->tor->info.name, nBad, nCandidates,
|
t->tor->info.name, nBad, nCandidates,
|
||||||
|
@ -2296,6 +2296,9 @@ reconnectPulse( void * vtorrent )
|
||||||
removePeer( t, peer );
|
removePeer( t, peer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tordbg( t, "nCandidates is %d, MAX_RECONNECTIONS_PER_PULSE is %d, getPeerCount(t) is %d, getMaxPeerCount(t) is %d, newConnectionsThisSecond is %d, MAX_CONNECTIONS_PER_SECOND is %d",
|
||||||
|
(int)nCandidates, (int)MAX_RECONNECTIONS_PER_PULSE, (int)getPeerCount( t ), (int)getMaxPeerCount( t->tor ), (int)newConnectionsThisSecond, (int)MAX_CONNECTIONS_PER_SECOND );
|
||||||
|
|
||||||
/* add some new ones */
|
/* add some new ones */
|
||||||
for( i = 0; ( i < nCandidates )
|
for( i = 0; ( i < nCandidates )
|
||||||
&& ( i < MAX_RECONNECTIONS_PER_PULSE )
|
&& ( i < MAX_RECONNECTIONS_PER_PULSE )
|
||||||
|
|
|
@ -59,7 +59,7 @@ enum
|
||||||
FIRST_ANNOUNCE_RETRY_INTERVAL_SEC = 30,
|
FIRST_ANNOUNCE_RETRY_INTERVAL_SEC = 30,
|
||||||
|
|
||||||
/* the value of the 'numwant' argument passed in tracker requests. */
|
/* the value of the 'numwant' argument passed in tracker requests. */
|
||||||
NUMWANT = 80,
|
NUMWANT = 200,
|
||||||
|
|
||||||
/* the length of the 'key' argument passed in tracker requests */
|
/* the length of the 'key' argument passed in tracker requests */
|
||||||
KEYLEN = 10
|
KEYLEN = 10
|
||||||
|
|
Loading…
Reference in New Issue