Changeset 12093


Ignore:
Timestamp:
Mar 4, 2011, 5:33:29 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) #3208 "Local Peer Discovery idea: prioritize LPD requests for downloads" -- add patch from Eszet

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r11896 r12093  
    6464
    6565    /* this is an upper limit for the frequency of LDS announces */
    66     LPD_HOUSEKEEPING_INTERVAL_SECS = 30
     66    LPD_HOUSEKEEPING_INTERVAL_SECS = 5
    6767
    6868};
  • trunk/libtransmission/tr-lpd.c

    r11599 r12093  
    553553        if( tr_isTorrent( tor ) )
    554554        {
    555             if( !tr_torrentAllowsLPD( tor ) || (
    556                     ( tr_torrentGetActivity( tor ) != TR_STATUS_DOWNLOAD ) &&
    557                     ( tr_torrentGetActivity( tor ) != TR_STATUS_SEED ) ) )
     555            int announcePrio = 0;
     556
     557            if( !tr_torrentAllowsLPD( tor ) )
    558558                continue;
    559559
    560             if( tor->lpdAnnounceAt <= now )
     560            /* issue #3208: prioritize downloads before seeds */
     561            switch( tr_torrentGetActivity( tor ) )
     562            {
     563            case TR_STATUS_DOWNLOAD:
     564                announcePrio = 1;
     565                break;
     566            case TR_STATUS_SEED:
     567                announcePrio = 2;
     568                break;
     569            default: /* fall through */
     570                break;
     571            }
     572
     573            if( announcePrio > 0 && tor->lpdAnnounceAt <= now )
    561574            {
    562575                if( tr_lpdSendAnnounce( tor ) )
    563576                    announcesSent++;
    564577
    565                 tor->lpdAnnounceAt = now + lpd_announceInterval;
     578                tor->lpdAnnounceAt = now +
     579                    lpd_announceInterval * announcePrio;
     580
    566581                break; /* that's enough; for this interval */
    567582            }
Note: See TracChangeset for help on using the changeset viewer.