Ticket #3208: libtransmission_patch_r6.1_20100515.diff

File libtransmission_patch_r6.1_20100515.diff, 1.8 KB (added by Eszet, 12 years ago)

First proposal for downloads to have priority before seeding torrents (minimal approach)

  • libtransmission/announcer.c

    === libtransmission/announcer.c
    ==================================================================
     
    6969    UPKEEP_INTERVAL_SECS = 1,
    7070
    7171    /* this is an upper limit for the frequency of LDS announces */
    72     LPD_HOUSEKEEPING_INTERVAL_SECS = 30
     72    LPD_HOUSEKEEPING_INTERVAL_SECS = 5
    7373
    7474};
    7575
  • libtransmission/tr-lpd.c

    === libtransmission/tr-lpd.c
    ==================================================================
     
    561561    {
    562562        if( tr_isTorrent( tor ) )
    563563        {
    564             if( !tr_torrentAllowsLPD( tor ) || (
    565                     ( tr_torrentGetActivity( tor ) != TR_STATUS_DOWNLOAD ) &&
    566                     ( tr_torrentGetActivity( tor ) != TR_STATUS_SEED ) ) )
     564            int announcePrio = 0;
     565
     566            if( !tr_torrentAllowsLPD( tor ) )
    567567                continue;
    568568
    569             if( tor->lpdAnnounceAt <= now )
     569            /* issue #3208: prioritize downloads before seeds */
     570            switch( tr_torrentGetActivity( tor ) )
    570571            {
     572            case TR_STATUS_DOWNLOAD:
     573                announcePrio = 1;
     574                break;
     575            case TR_STATUS_SEED:
     576                announcePrio = 2;
     577                break;
     578            default: /* fall through */
     579                break;
     580            }
     581
     582            if( announcePrio > 0 && tor->lpdAnnounceAt <= now )
     583            {
    571584                if( tr_lpdSendAnnounce( tor ) )
    572585                    announcesSent++;
    573586
    574                 tor->lpdAnnounceAt = now + lpd_announceInterval;
     587                tor->lpdAnnounceAt = now +
     588                    lpd_announceInterval * announcePrio;
     589
    575590                break; /* that's enough; for this interval */
    576591            }
    577592        }