Ticket #4888: magnet-left-until-complete.patch

File magnet-left-until-complete.patch, 2.8 KB (added by jordan, 10 years ago)
  • libtransmission/completion.h

     
    8989    return cp->sizeNow;
    9090}
    9191
    92 static inline uint64_t
    93 tr_cpLeftUntilComplete( const tr_completion * cp )
    94 {
    95     return tr_torrentInfo(cp->tor)->totalSize - cp->sizeNow;
    96 }
    97 
    9892static inline bool tr_cpHasAll( const tr_completion * cp )
    9993{
    10094    return tr_bitfieldHasAll( &cp->blockBitfield );
  • libtransmission/announcer.c

     
    912912    req->up = tier->byteCounts[TR_ANN_UP];
    913913    req->down = tier->byteCounts[TR_ANN_DOWN];
    914914    req->corrupt = tier->byteCounts[TR_ANN_CORRUPT];
    915     req->left = tr_cpLeftUntilComplete( &tor->completion );
     915    req->leftUntilComplete = tr_torrentHasMetadata( tor )
     916            ? tor->info.totalSize - tr_cpHaveTotal( &tor->completion )
     917            : ~(uint64_t)0;
    916918    req->event = event;
    917919    req->numwant = event == TR_ANNOUNCE_EVENT_STOPPED ? 0 : NUMWANT;
    918920    req->key = announcer->key;
  • libtransmission/announcer-udp.c

     
    323323    evbuffer_add        ( buf, in->info_hash, SHA_DIGEST_LENGTH );
    324324    evbuffer_add        ( buf, in->peer_id, PEER_ID_LEN );
    325325    evbuffer_add_hton_64( buf, in->down );
    326     evbuffer_add_hton_64( buf, in->left );
     326    evbuffer_add_hton_64( buf, in->leftUntilComplete );
    327327    evbuffer_add_hton_64( buf, in->up );
    328328    evbuffer_add_hton_32( buf, get_tau_announce_event( in->event ) );
    329329    evbuffer_add_hton_32( buf, 0 );
  • libtransmission/announcer-common.h

     
    148148    uint64_t corrupt;
    149149
    150150    /* the total size of the torrent minus the number of bytes completed */
    151     uint64_t left;
     151    uint64_t leftUntilComplete;
    152152
    153153    /* the tracker's announce URL */
    154154    char * url;
  • libtransmission/announcer-http.c

     
    8181                              req->port,
    8282                              req->up,
    8383                              req->down,
    84                               req->left,
     84                              req->leftUntilComplete,
    8585                              req->numwant,
    8686                              req->key );
    8787