Changeset 3178


Ignore:
Timestamp:
Sep 26, 2007, 1:55:04 AM (14 years ago)
Author:
charles
Message:

modify the tr_stat struct as hashed out by charles_ and BentMyWookie?. sync gtk, ipc, and wx clients.

Location:
trunk
Files:
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/README

    r3014 r3178  
    1010and BeOS (native interface).
    1111
    12 For more information (including build instructions), please consult the
    13 website: http://transmission.m0k.org/
     12For more information (including build instructions),
     13please consult the website: http://transmission.m0k.org/
    1414
    1515
     
    1717=====================
    1818
    19 Transmission has an Xcode project file (Transmission.xcodeproj) that allows it to be built in Xcode.
     19Transmission has an Xcode project file (Transmission.xcodeproj)
     20that allows it to be built in Xcode.
    2021
    2122Building a Transmission release from the command line:
  • trunk/gtk/torrent-inspector.c

    r3154 r3178  
    814814{
    815815  GtkWidget * state_lb;
     816  GtkWidget * corrupt_dl_lb;
    816817  GtkWidget * valid_dl_lb;
    817818  GtkWidget * dl_lb;
     
    833834  Activity * a = (Activity*) g_object_get_data (G_OBJECT(top), "activity-data");
    834835  const tr_stat * stat = tr_torrent_stat( a->gtor );
    835   guint64 size;
    836836  char *pch;
    837837
     
    840840  g_free (pch);
    841841
    842   size = stat->downloadedValid;
    843   pch = readablesize (size);
     842  pch = readablesize (stat->corruptEver);
     843  gtk_label_set_text (GTK_LABEL(a->corrupt_dl_lb), pch);
     844  g_free (pch);
     845
     846  pch = readablesize (stat->haveValid);
    844847  gtk_label_set_text (GTK_LABEL(a->valid_dl_lb), pch);
    845848  g_free (pch);
    846849
    847   pch = readablesize (stat->downloaded);
     850  pch = readablesize (stat->downloadedEver);
    848851  gtk_label_set_text (GTK_LABEL(a->dl_lb), pch);
    849852  g_free (pch);
    850853
    851   pch = readablesize (stat->uploaded);
     854  pch = readablesize (stat->uploadedEver);
    852855  gtk_label_set_text (GTK_LABEL(a->ul_lb), pch);
    853856  g_free (pch);
    854857
    855   pch = ratiostr (stat->downloaded, stat->uploaded);
     858  pch = ratiostr (stat->downloadedEver, stat->uploadedEver);
    856859  gtk_label_set_text (GTK_LABEL(a->ratio_lb), pch);
    857860  g_free (pch);
     
    861864  g_free (pch);
    862865
    863   pch = readablesize (stat->left);
     866  pch = readablesize (stat->leftUntilDone);
    864867  gtk_label_set_text (GTK_LABEL(a->remaining_lb), pch);
    865868  g_free (pch);
     
    900903    g_snprintf (name, sizeof(name), namefmt, _("State"));
    901904    l = a->state_lb = gtk_label_new (NULL);
     905    hig_workarea_add_row (t, &row, name, l, NULL);
     906
     907    g_snprintf (name, sizeof(name), namefmt, _("Corrupt DL"));
     908    l = a->corrupt_dl_lb = gtk_label_new (NULL);
    902909    hig_workarea_add_row (t, &row, name, l, NULL);
    903910
  • trunk/gtk/tr_core.c

    r3111 r3178  
    610610                            MC_DONE,        st->completedFromTracker,
    611611                            MC_TRACKER,     st->tracker,
    612                             MC_DOWN,        st->downloaded,
    613                             MC_UP,          st->uploaded,
    614                             MC_LEFT,        st->left,
     612                            MC_DOWN,        st->downloadedEver,
     613                            MC_UP,          st->uploadedEver,
     614                            MC_LEFT,        st->leftUntilDone,
    615615                            -1 );
    616616    }
  • trunk/libtransmission/completion.c

    r3111 r3178  
    291291
    292292uint64_t
    293 tr_cpDownloadedValid( const tr_completion * cp )
     293tr_cpHaveValid( const tr_completion * cp )
    294294{
    295295    uint64_t b = 0;
     
    309309   return b;
    310310}
     311
     312uint64_t
     313tr_cpHaveTotal( const tr_completion * cp )
     314{
     315   return cp->completeHave;
     316}
  • trunk/libtransmission/completion.h

    r3105 r3178  
    3737
    3838cp_status_t      tr_cpGetStatus ( const tr_completion * );
    39 uint64_t         tr_cpDownloadedValid( const tr_completion * );
     39uint64_t         tr_cpHaveTotal( const tr_completion * );
     40uint64_t         tr_cpHaveValid( const tr_completion * );
    4041uint64_t         tr_cpLeftUntilComplete( const tr_completion * );
    4142uint64_t         tr_cpLeftUntilDone( const tr_completion * );
  • trunk/libtransmission/ipcparse.c

    r3111 r3178  
    768768        {
    769769            case IPC_ST_COMPLETED:
    770                 tr_bencInitInt( item, st->downloadedValid );
     770            case IPC_ST_DOWNVALID:
     771                tr_bencInitInt( item, st->haveValid );
    771772                break;
    772773            case IPC_ST_DOWNSPEED:
     
    774775                break;
    775776            case IPC_ST_DOWNTOTAL:
    776                 tr_bencInitInt( item, st->downloaded );
    777                 break;
    778             case IPC_ST_DOWNVALID:
    779                 tr_bencInitInt( item, st->downloadedValid );
     777                tr_bencInitInt( item, st->downloadedEver );
    780778                break;
    781779            case IPC_ST_ERROR:
     
    922920                break;
    923921            case IPC_ST_UPTOTAL:
    924                 tr_bencInitInt( item, st->uploaded );
     922                tr_bencInitInt( item, st->uploadedEver );
    925923                break;
    926924            default:
  • trunk/libtransmission/peer-mgr-private.h

    r3144 r3178  
    3131    unsigned int  doDisconnect : 1;
    3232
     33    uint8_t from;
     34    uint16_t port;
    3335    struct in_addr in_addr;
    34     uint16_t port;
    3536    struct tr_peerIo * io;
    36     uint8_t from;
    3737
    3838    struct tr_bitfield * banned;
     
    4646    time_t clientSentPieceDataAt;
    4747    time_t peerSentPieceDataAt;
    48     time_t peerSentKeepaliveAt;
    4948    time_t chokeChangedAt;
    5049    time_t connectionChangedAt;
  • trunk/libtransmission/peer-msgs.c

    r3169 r3178  
    621621    tr_peerIoReadUint32( msgs->io, inbuf, &len );
    622622
    623     if( len == 0 ) { /* peer sent us a keepalive message */
     623    if( len == 0 ) /* peer sent us a keepalive message */
    624624        dbgmsg( msgs, "peer sent us a keepalive message..." );
    625         msgs->info->peerSentKeepaliveAt = time( NULL );
    626     } else {
     625    else {
    627626        dbgmsg( msgs, "peer is sending us a message with %"PRIu64" bytes...\n", (uint64_t)len );
    628627        msgs->incomingMessageLength = len;
    629628        msgs->state = AWAITING_BT_MESSAGE;
    630     } return READ_AGAIN;
     629    }
     630
     631    return READ_AGAIN;
    631632}
    632633
  • trunk/libtransmission/torrent.c

    r3170 r3178  
    761761
    762762    s->percentDone = tr_cpPercentDone( tor->completion );
    763     s->left = tr_cpLeftUntilDone( tor->completion );
     763    s->leftUntilDone = tr_cpLeftUntilDone( tor->completion );
    764764
    765765    switch( tor->runStatus ) {
     
    802802    s->eta = s->rateDownload < 0.1
    803803        ? -1.0f
    804         : (s->left / s->rateDownload / 1024.0);
    805 
    806     s->corrupt         = tor->corruptCur    + tor->corruptPrev;
    807     s->uploaded        = tor->uploadedCur   + tor->uploadedPrev;
    808     s->downloaded      = tor->downloadedCur + tor->downloadedPrev;
    809     s->downloadedValid = tr_cpDownloadedValid( tor->completion );
     804        : (s->leftUntilDone / s->rateDownload / 1024.0);
     805
     806    s->corruptEver     = tor->corruptCur    + tor->corruptPrev;
     807    s->downloadedEver  = tor->downloadedCur + tor->downloadedPrev;
     808    s->uploadedEver    = tor->uploadedCur   + tor->uploadedPrev;
     809    s->haveValid       = tr_cpHaveValid( tor->completion );
     810    s->haveUnchecked   = tr_cpHaveTotal( tor->completion ) - s->haveValid;
    810811   
    811     s->ratio = s->downloaded || s->downloadedValid
    812       ? (float)s->uploaded / (float)MAX(s->downloaded, s->downloadedValid)
    813       : TR_RATIO_NA;
     812    s->ratio = s->downloadedEver ? s->uploadedEver / (float)s->downloadedEver
     813                                 : TR_RATIO_NA;
    814814   
    815815    tr_torrentUnlock( tor );
  • trunk/libtransmission/transmission.h

    r3170 r3178  
    6363#define TR_DEFAULT_PORT   9090
    6464
    65 #define TR_PEER_FROM__MAX       4
    66 #define TR_PEER_FROM_INCOMING   0 /* connections made to the listening port */
    67 #define TR_PEER_FROM_TRACKER    1 /* peers received from a tracker */
    68 #define TR_PEER_FROM_CACHE      2 /* peers read from the peer cache */
    69 #define TR_PEER_FROM_PEX        3 /* peers discovered via PEX */
     65enum
     66{
     67    TR_PEER_FROM_INCOMING  = 0,  /* connections made to the listening port */
     68    TR_PEER_FROM_TRACKER   = 1,  /* peers received from a tracker */
     69    TR_PEER_FROM_CACHE     = 2,  /* peers read from the peer cache */
     70    TR_PEER_FROM_PEX       = 3,  /* peers discovered via PEX */
     71    TR_PEER_FROM__MAX
     72};
    7073
    7174/***********************************************************************
     
    645648    int                 completedFromTracker;
    646649
    647     uint64_t            left;
    648     uint64_t            downloaded;
    649     uint64_t            downloadedValid;
    650     uint64_t            uploaded;
    651     uint64_t            corrupt;
     650    /* Byte count of how much data is left to be downloaded until
     651     * we're done -- that is, until we've got all the pieces we wanted. */
     652    uint64_t            leftUntilDone;
     653
     654    /* Byte count of all the corrupt data you've ever downloaded for
     655     * this torrent.  If you're on a poisoned torrent, this number can
     656     * grow very large. */
     657    uint64_t            corruptEver;
     658
     659    /* Byte count of all data you've ever uploaded for this torrent. */
     660    uint64_t            uploadedEver;
     661
     662    /* Byte count of all the non-corrupt data you've ever downloaded
     663     * for this torrent.  If you deleted the files and downloaded a second time,
     664     * this will be 2*totalSize.. */
     665    uint64_t            downloadedEver;
     666
     667    /* Byte count of all the checksum-verified data we have for this torrent. */
     668    uint64_t            haveValid;
     669
     670    /* Byte count of all the partial piece data we have for this torrent.
     671     * As pieces become complete, this value may decrease as portions of it are
     672     * moved to `corrupt' or `haveValid'. */
     673    uint64_t            haveUnchecked;
     674
    652675    float               swarmspeed;
    653676
  • trunk/wx/filter.cc

    r3109 r3178  
    5050        : FLAG_IDLE;
    5151
    52     flags |= s->left
     52    flags |= s->leftUntilDone
    5353        ? FLAG_INCOMPLETE
    5454        : FLAG_COMPLETE;
  • trunk/wx/torrent-list.cc

    r3137 r3178  
    275275
    276276            case COL_RATIO:
    277                 xstr = wxString::Format( _T("%%%d"), (int)(s->uploaded / (double)s->downloadedValid) );
     277                xstr = wxString::Format( _T("%%%d"), (int)(s->uploadedEver / (double)s->downloadedEver) );
    278278                break;
    279279
    280280            case COL_RECEIVED:
    281                 xstr = getReadableSize( s->downloaded );
     281                xstr = getReadableSize( s->downloadedEver );
    282282                break;
    283283
    284284            case COL_REMAINING:
    285                 xstr = getReadableSize( s->left );
     285                xstr = getReadableSize( s->leftUntilDone );
    286286                break;
    287287
     
    294294
    295295            case COL_SENT:
    296                 xstr = getReadableSize( s->uploaded );
     296                xstr = getReadableSize( s->uploadedEver );
    297297                break;
    298298
     
    448448
    449449        case COL_RATIO: {
    450             const double ra = sa->uploaded / (double) sa->downloadedValid;
    451             const double rb = sb->uploaded / (double) sb->downloadedValid;
     450            const double ra = sa->uploadedEver / (double)(sa->downloadedEver + 0.01);
     451            const double rb = sb->uploadedEver / (double)(sb->downloadedEver + 0.01);
    452452            if( ra < rb )
    453453                ret = -1;
     
    460460
    461461        case COL_RECEIVED:
    462             if( sa->downloaded < sb->downloaded )
     462            if( sa->downloadedEver < sb->downloadedEver )
    463463                ret = -1;
    464             else if( sa->downloaded > sb->downloaded )
     464            else if( sa->downloadedEver > sb->downloadedEver )
    465465                ret = 1;
    466466            else
     
    469469
    470470        case COL_REMAINING:
    471             if( sa->left < sb->left )
     471            if( sa->leftUntilDone < sb->leftUntilDone )
    472472                ret = -1;
    473             else if( sa->left > sb->left )
     473            else if( sa->leftUntilDone > sb->leftUntilDone )
    474474                ret = 1;
    475475            else
     
    483483
    484484        case COL_SENT:
    485             if( sa->uploaded < sb->uploaded )
     485            if( sa->uploadedEver < sb->uploadedEver )
    486486                ret = -1;
    487             else if( sa->uploaded > sb->uploaded )
     487            else if( sa->uploadedEver > sb->uploadedEver )
    488488                ret = 1;
    489489            else
Note: See TracChangeset for help on using the changeset viewer.