Changeset 7761
- Timestamp:
- Jan 20, 2009, 3:32:54 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-mgr.c
r7740 r7761 2032 2032 * if we have zero connections, strictness is 0% */ 2033 2033 const float strictness = peerCount >= relaxStrictnessIfFewerThanN 2034 ? 1.02035 : peerCount / (float)relaxStrictnessIfFewerThanN;2034 ? 1.0 2035 : peerCount / (float)relaxStrictnessIfFewerThanN; 2036 2036 const int lo = MIN_UPLOAD_IDLE_SECS; 2037 2037 const int hi = MAX_UPLOAD_IDLE_SECS; … … 2213 2213 struct peer_atom ** candidates = getPeerCandidates( t, &nCandidates ); 2214 2214 struct tr_peer ** connections = getPeersToClose( t, &nBad ); 2215 int maxCandidates; 2216 2217 maxCandidates = nCandidates; 2218 maxCandidates = MAX( maxCandidates, MAX_RECONNECTIONS_PER_PULSE ); 2219 maxCandidates = MAX( maxCandidates, getMaxPeerCount( t->tor ) - getPeerCount( t ) ); 2220 maxCandidates = MAX( maxCandidates, MAX_CONNECTIONS_PER_SECOND - newConnectionsThisSecond ); 2215 2221 2216 2222 //if( nBad || nCandidates ) … … 2221 2227 (int)MAX_RECONNECTIONS_PER_PULSE ); 2222 2228 2223 /* disconnect some peers .2229 /* disconnect some peers to make room for better ones. 2224 2230 if we transferred piece data, then they might be good peers, 2225 2231 so reset their `numFails' weight to zero. otherwise we connected 2226 2232 to them fruitlessly, so mark it as another fail */ 2227 for( i = 0; i < nBad; ++i ) {2233 for( i = 0; ( i < nBad ) && ( i < maxCandidates ) ; ++i ) { 2228 2234 tr_peer * peer = connections[i]; 2229 2235 struct peer_atom * atom = getExistingAtom( t, &peer->addr );
Note: See TracChangeset
for help on using the changeset viewer.