Changeset 12128


Ignore:
Timestamp:
Mar 11, 2011, 4:57:53 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) optimization for ocelot.

When seeding on a private tracker, ocelot omits other seeds from the list of peers returned. We can test for this and update our "seed probability" field accordingly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r12127 r12128  
    489489
    490490static int8_t
    491 getSeedProbability( int seeds, int leechers )
    492 {
     491getSeedProbability( tr_tier * tier, int seeds, int leechers, int pex_count )
     492{
     493    /* special case optimization:
     494       ocelot omits seeds from peer lists sent to seeds on private trackers.
     495       so check for that case... */
     496    if( ( leechers == pex_count ) && tr_torrentIsPrivate( tier->tor )
     497                                  && tr_torrentIsSeed( tier->tor )
     498                                  && ( seeds + leechers < NUMWANT ) )
     499        return 0;
     500
    493501    if( !seeds )
    494502        return 0;
     
    505513{
    506514    tr_tracker_event e = TRACKER_EVENT_INIT;
    507 
    508515    e.messageType = TR_TRACKER_PEERS;
    509     e.seedProbability = getSeedProbability( seeds, leechers );
     516    e.seedProbability = getSeedProbability( tier, seeds, leechers, n );
    510517    e.pex = pex;
    511518    e.pexCount = n;
     519
     520    dbgmsg( tier, "got %d peers; seed probability %d", n, (int)e.seedProbability );
    512521
    513522    if( tier->tor->tiers->callback != NULL )
Note: See TracChangeset for help on using the changeset viewer.