Changeset 2071


Ignore:
Timestamp:
Jun 14, 2007, 3:19:44 AM (15 years ago)
Author:
charles
Message:

added `downloadedValid' field to tr_stat_s so the frontends don't have to estimate it. This should fix the "incorrect amount dl'ed" bug reported by Waldorf.

Location:
branches/file_selection
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/file_selection/gtk/torrent-inspector.c

    r2054 r2071  
    600600                                       GTK_SHADOW_IN);
    601601  gtk_container_add (GTK_CONTAINER(w), v);
    602   gtk_widget_set_usize (w, 500u, 0u);
    603602
    604603
     
    806805  Activity * a = (Activity*) g_object_get_data (G_OBJECT(top), "activity-data");
    807806  const tr_stat_t * stat = tr_torrent_stat( a->gtor );
    808   const tr_info_t * info = tr_torrent_info( a->gtor );
    809807  guint64 size;
    810808  char *pch;
     
    814812  g_free (pch);
    815813
    816   size = info->totalSize - stat->left;
     814  size = stat->downloadedValid;
    817815  pch = readablesize (size);
    818816  gtk_label_set_text (GTK_LABEL(a->valid_dl_lb), pch);
  • branches/file_selection/libtransmission/completion.c

    r2069 r2071  
    336336
    337337uint64_t
    338 tr_cpBytesUntilComplete ( const tr_completion_t * cp )
     338tr_cpLeftUntilComplete ( const tr_completion_t * cp )
    339339{
    340340    int i;
     
    356356
    357357uint64_t
    358 tr_cpBytesUntilDone ( const tr_completion_t * cp )
     358tr_cpLeftUntilDone ( const tr_completion_t * cp )
    359359{
    360360    int i;
     
    414414    return !total ? 0.0f : (float)have / (float)total;
    415415}
     416
     417uint64_t
     418tr_cpDownloadedValid( const tr_completion_t * cp )
     419{
     420    int i, n;
     421    uint64_t b=0;
     422
     423    for( i=0, n=cp->tor->info.pieceCount; i<n; ++i )
     424        b += cp->completeBlocks[ i ];
     425
     426   return b * cp->tor->blockSize;
     427}
  • branches/file_selection/libtransmission/completion.h

    r2065 r2071  
    4343int tr_cpGetState ( const tr_completion_t * );
    4444
    45 uint64_t              tr_cpBytesUntilComplete( const tr_completion_t * );
    46 uint64_t              tr_cpBytesUntilDone( const tr_completion_t * );
     45uint64_t              tr_cpDownloadedValid( const tr_completion_t * );
     46uint64_t              tr_cpLeftUntilComplete( const tr_completion_t * );
     47uint64_t              tr_cpLeftUntilDone( const tr_completion_t * );
    4748float                 tr_cpPercentComplete( const tr_completion_t * );
    4849float                 tr_cpPercentDone( const tr_completion_t * );
  • branches/file_selection/libtransmission/torrent.c

    r2070 r2071  
    464464
    465465    s->progress = tr_cpPercentDone( tor->completion );
    466     s->left     = tr_cpBytesUntilDone( tor->completion );
     466    s->left     = tr_cpLeftUntilDone( tor->completion );
    467467    if( tor->status & TR_STATUS_DOWNLOAD )
    468468    {
     
    497497    }
    498498
    499     s->downloaded = tor->downloadedCur + tor->downloadedPrev;
    500     s->uploaded   = tor->uploadedCur   + tor->uploadedPrev;
     499    s->uploaded        = tor->uploadedCur   + tor->uploadedPrev;
     500    s->downloaded      = tor->downloadedCur + tor->downloadedPrev;
     501    s->downloadedValid = tr_cpDownloadedValid( tor->completion );
    501502   
    502503    if( s->downloaded == 0 && s->progress == 0.0 )
     
    506507    else
    507508    {
    508         s->ratio = (float)s->uploaded / (float)MAX(s->downloaded, inf->totalSize - s->left);
     509        s->ratio = (float)s->uploaded
     510                 / (float)MAX(s->downloaded, s->downloadedValid);
    509511    }
    510512   
  • branches/file_selection/libtransmission/tracker.c

    r2065 r2071  
    560560
    561561    start = ( strchr( tcInf->announce, '?' ) ? '&' : '?' );
    562     left  = tr_cpBytesUntilComplete( tor->completion );
     562    left  = tr_cpLeftUntilComplete( tor->completion );
    563563
    564564    return tr_httpClient( TR_HTTP_GET, tcInf->address, tcInf->port,
  • branches/file_selection/libtransmission/transmission.h

    r2064 r2071  
    520520    uint64_t            left;
    521521    uint64_t            downloaded;
     522    uint64_t            downloadedValid;
    522523    uint64_t            uploaded;
    523524    float               swarmspeed;
  • branches/file_selection/macosx/Torrent.m

    r2041 r2071  
    12541254- (uint64_t) downloadedValid
    12551255{
    1256     return fInfo->totalSize - fStat->left;
     1256    return fStat->downloadedValid;
    12571257}
    12581258
Note: See TracChangeset for help on using the changeset viewer.