Changeset 2891


Ignore:
Timestamp:
Aug 21, 2007, 3:17:02 PM (15 years ago)
Author:
charles
Message:

added support for `corrupt' announce tag s.t. corrupted bytes don't count towards your download ratio

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEWS

    r2648 r2891  
    11NEWS file for Transmission <http://transmission.m0k.org/>
     2
     30.90 (2007/xx/yy)
     4 - Improved compliance with bittorrent spec.
     5 - Multiscrape support added.
     6 - Only report downloaded, verified good pieces in tracker `download' field.
     7
     80.81 (2007/xx/yy)
     9 - Fix 0.80 assertion crashes.
     10 - Fix a bug which miscounted how many peers Transmission wants connected
     11 - Memory leaks fixed.
     12 - OS X:
     13   + Multiple fixes to creating torrents and adding new torrents
     14   + Updated Russian translation
     15 - GTK:
     16   + Updated Dutch, Portuguese, French, and Slovakian translations
     17 - CLI:
     18   + Better support for cli-driven torrent creation.
     19   + Fix a bug which misparsed command-line arguments.
    220
    3210.80 (2007/08/07)
  • trunk/libtransmission/completion.c

    r2657 r2891  
    141141}
    142142
    143 int tr_cpPieceHasAllBlocks( const tr_completion_t * cp, int piece )
    144 {
    145     return tr_cpPieceIsComplete( cp, piece );
    146 }
    147 
    148143int tr_cpPieceIsComplete( const tr_completion_t * cp, int piece )
    149144{
  • trunk/libtransmission/completion.h

    r2555 r2891  
    4545
    4646/* Pieces */
    47 int                   tr_cpPieceHasAllBlocks( const tr_completion_t *, int piece );
    4847int                   tr_cpPieceIsComplete( const tr_completion_t *, int piece );
    4948void                  tr_cpPieceAdd( tr_completion_t *, int piece );
  • trunk/libtransmission/fastresume.c

    r2884 r2891  
    9898     * char: 't' if running, 'f' if paused
    9999     */
    100     FR_ID_RUN = 9
     100    FR_ID_RUN = 9,
     101
     102    /* number of corrupt bytes downloaded */
     103    FR_ID_CORRUPT = 10
    101104};
    102105
     
    273276    if( TRUE ) /* FR_ID_RUN */
    274277    {
    275         const int run = tor->runStatusToSave>=0
     278        const int run = tor->runStatusToSaveIsSet
    276279            ? tor->runStatusToSave
    277280            : tor->runStatus;
     
    285288    total = tor->uploadedCur + tor->uploadedPrev;
    286289    fastResumeWriteData( FR_ID_UPLOADED, &total, 8, 1, file );
     290    total = tor->corruptCur + tor->corruptPrev;
     291    fastResumeWriteData( FR_ID_CORRUPT, &total, 8, 1, file );
    287292
    288293    if( !( TR_FLAG_PRIVATE & tor->info.flags ) )
     
    617622                break;
    618623
     624            case FR_ID_CORRUPT:
     625                /* read upload total */
     626                if( 8 == len )
     627                {
     628                    if( 1 != fread( &tor->corruptPrev, 8, 1, file ) )
     629                    {
     630                        fclose( file );
     631                        return ret;
     632                    }
     633                    tor->corruptCur = 0;
     634                    ret |= TR_FR_CORRUPT;
     635                    continue;
     636                }
     637                break;
     638
    619639            case FR_ID_PEERS:
    620640                if( !( TR_FLAG_PRIVATE & tor->info.flags ) )
  • trunk/libtransmission/fastresume.h

    r2739 r2891  
    3232  TR_FR_DOWNLOADED   = (1<<0),
    3333  TR_FR_UPLOADED     = (1<<1),
    34   TR_FR_PEERS        = (1<<2),
    35   TR_FR_PROGRESS     = (1<<3),
    36   TR_FR_PRIORITY     = (1<<4),
    37   TR_FR_SPEEDLIMIT   = (1<<5),
    38   TR_FR_RUN          = (1<<6),
     34  TR_FR_CORRUPT      = (1<<2),
     35  TR_FR_PEERS        = (1<<3),
     36  TR_FR_PROGRESS     = (1<<4),
     37  TR_FR_PRIORITY     = (1<<5),
     38  TR_FR_SPEEDLIMIT   = (1<<6),
     39  TR_FR_RUN          = (1<<7)
    3940};
    4041
  • trunk/libtransmission/internal.h

    r2884 r2891  
    143143    run_status_t               runStatus;
    144144    run_status_t               runStatusToSave;
     145    char                       runStatusToSaveIsSet;
    145146    cp_status_t                cpStatus;
    146147    struct tr_thread_s       * thread;
     
    162163    uint64_t                   uploadedCur;
    163164    uint64_t                   uploadedPrev;
     165    uint64_t                   corruptCur;
     166    uint64_t                   corruptPrev;
    164167    uint64_t                   activityDate;
    165168
  • trunk/libtransmission/peer.c

    r2805 r2891  
    306306}
    307307
     308static void tr_peerPieceIsCorrupt  ( tr_peer_t *, int pieceIndex );
     309
    308310#include "peerext.h"
    309311#include "peeraz.h"
     
    970972
    971973void
    972 tr_peerSentBlockToUs ( tr_peer_t * peer, int byteCount )
     974tr_peerPieceIsCorrupt( tr_peer_t * peer, int pieceIndex )
     975{
     976    tr_torrent_t * tor = peer->tor;
     977
     978    const uint64_t byteCount = tr_torPieceCountBytes( tor, pieceIndex );
     979
     980    /* increment the `corrupt' field */
     981    tor->corruptCur += byteCount;
     982
     983    /* decrement the `downloaded' field */
     984    if( tor->downloadedCur >= byteCount )
     985        tor->downloadedCur -= byteCount;
     986    else
     987        tor->downloadedCur = 0;
     988}
     989
     990void
     991tr_peerSentBlockToUs( tr_peer_t * peer, int byteCount )
    973992{
    974993    tr_torrent_t * tor = peer->tor;
  • trunk/libtransmission/peerparse.h

    r2805 r2891  
    343343    broadcastCancel( tor, index, begin, len - 8 );
    344344
    345     if( !tr_cpPieceHasAllBlocks( tor->completion, index ) )
     345    if( !tr_cpPieceIsComplete( tor->completion, index ) )
    346346    {
    347347        return TR_OK;
     
    351351    if( ( ret = tr_ioHash( tor->io, index ) ) )
    352352    {
     353        tr_peerPieceIsCorrupt( peer, index );
    353354        return ret;
    354     }
    355     if( !tr_cpPieceIsComplete( tor->completion, index ) )
    356     {
    357         return TR_OK;
    358355    }
    359356
  • trunk/libtransmission/torrent.c

    r2884 r2891  
    250250    tor->pexDisabled = 0;
    251251
    252     tor->runStatusToSave = -1;
     252    tor->runStatusToSaveIsSet = FALSE;
    253253
    254254    /**
     
    764764        : (s->left / s->rateDownload / 1024.0);
    765765
     766    s->corrupt         = tor->corruptCur    + tor->corruptPrev;
    766767    s->uploaded        = tor->uploadedCur   + tor->uploadedPrev;
    767768    s->downloaded      = tor->downloadedCur + tor->downloadedPrev;
     
    974975    tor->uploadedPrev   += tor->uploadedCur;
    975976    tor->uploadedCur     = 0;
     977    tor->corruptPrev    += tor->corruptCur;
     978    tor->corruptCur      = 0;
    976979
    977980    tr_torrentWriterUnlock( tor );
     
    10851088{
    10861089    tor->runStatusToSave = tor->runStatus;
     1090    tor->runStatusToSaveIsSet = TRUE;
    10871091    tr_torrentStop( tor );
    10881092    tor->dieFlag = TRUE;
  • trunk/libtransmission/tracker.c

    r2886 r2891  
    786786                                "&uploaded=%"PRIu64
    787787                                "&downloaded=%"PRIu64
     788                                "&corrupt=%"PRIu64
    788789                                "&left=%"PRIu64
    789790                                "&compact=1"
     
    798799        torrent->uploadedCur,
    799800        torrent->downloadedCur,
     801        torrent->corruptCur,
    800802        tr_cpLeftUntilComplete( torrent->completion ),
    801803        numwant,
  • trunk/libtransmission/transmission.h

    r2805 r2891  
    630630    uint64_t            downloadedValid;
    631631    uint64_t            uploaded;
     632    uint64_t            corrupt;
    632633    float               swarmspeed;
    633634
Note: See TracChangeset for help on using the changeset viewer.