Changeset 10941


Ignore:
Timestamp:
Jul 4, 2010, 8:40:34 PM (12 years ago)
Author:
charles
Message:

(trunk libT) isPeerCandidate(): sort the filter tests in order of those that get the mosts hits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r10937 r10941  
    33303330isPeerCandidate( const tr_torrent * tor, struct peer_atom * atom, const time_t now )
    33313331{
    3332     /* not if they're banned... */
    3333     if( atom->myflags & MYFLAG_BANNED )
    3334         return FALSE;
    3335 
    33363332    /* not if we're both seeds */
    33373333    if( tr_torrentIsSeed( tor ) )
    33383334        if( atomIsSeed( atom ) || ( atom->uploadOnly == UPLOAD_ONLY_YES ) )
    33393335            return FALSE;
    3340  
     3336
     3337    /* not if we've already got a connection to them...  */
     3338    if( peerIsInUse( tor->torrentPeers, atom ) )
     3339        return FALSE;
     3340
    33413341    /* not if we just tried them already */
    33423342    if( ( now - atom->time ) < getReconnectIntervalSecs( atom, now ) )
     
    33473347        return FALSE;
    33483348
    3349     /* not if we've already got a connection to them... */
    3350     if( peerIsInUse( tor->torrentPeers, atom ) )
     3349    /* not if they're banned... */
     3350    if( atom->myflags & MYFLAG_BANNED )
    33513351        return FALSE;
    33523352
     
    34663466        n += tr_ptrArraySize( &tor->torrentPeers->pool );
    34673467    walk = candidates = tr_new( struct peer_candidate, n );
     3468fprintf( stderr, "nCandidates is %d\n", (int)n );
    34683469
    34693470    /* populate the candidate array */
     
    35023503
    35033504    *candidateCount = walk - candidates;
     3505fprintf( stderr, "candidateCount is %d\n", (int)(*candidateCount) );
    35043506    if( *candidateCount > 1 )
    35053507        qsort( candidates, *candidateCount, sizeof( struct peer_candidate ), comparePeerCandidates );
Note: See TracChangeset for help on using the changeset viewer.