From 78cf80d3c099b5e13a82edc2bee8c23dabb9dae3 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 3 Jan 2009 07:23:26 +0000 Subject: [PATCH] (trunk libT) experimental code to get more peers faster --- libtransmission/peer-mgr.c | 11 +++++++---- libtransmission/tracker.c | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index c1147ecc4..1b4a7946e 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -61,11 +61,11 @@ enum BANDWIDTH_PERIOD_MSEC = 500, /* 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. * this throttle is to avoid overloading the router */ - MAX_CONNECTIONS_PER_SECOND = 8, + MAX_CONNECTIONS_PER_SECOND = 32, /* number of unchoked peers per torrent. * FIXME: this probably ought to be configurable */ @@ -1175,7 +1175,7 @@ getMaxPeerCount( const tr_torrent * tor ) static int 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. */ @@ -2274,7 +2274,7 @@ reconnectPulse( void * vtorrent ) struct peer_atom ** candidates = getPeerCandidates( t, &nCandidates ); struct tr_peer ** connections = getPeersToClose( t, &nBad ); - if( nBad || nCandidates ) + //if( nBad || nCandidates ) tordbg( t, "reconnect pulse for [%s]: %d bad connections, " "%d connection candidates, %d atoms, max per pulse is %d", t->tor->info.name, nBad, nCandidates, @@ -2296,6 +2296,9 @@ reconnectPulse( void * vtorrent ) 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 */ for( i = 0; ( i < nCandidates ) && ( i < MAX_RECONNECTIONS_PER_PULSE ) diff --git a/libtransmission/tracker.c b/libtransmission/tracker.c index 5f57d8003..58692fb5c 100644 --- a/libtransmission/tracker.c +++ b/libtransmission/tracker.c @@ -59,7 +59,7 @@ enum FIRST_ANNOUNCE_RETRY_INTERVAL_SEC = 30, /* the value of the 'numwant' argument passed in tracker requests. */ - NUMWANT = 80, + NUMWANT = 200, /* the length of the 'key' argument passed in tracker requests */ KEYLEN = 10