Changeset 216 for trunk/libtransmission


Ignore:
Timestamp:
Apr 7, 2006, 5:30:30 PM (16 years ago)
Author:
joshe
Message:

Fixed bug where incorrect stats were being reported to the tracker.
This was introduced when download and upload totals became persistent.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r164 r216  
    5555    int            bindPort;
    5656    int            newPort;
     57
     58    uint64_t       download;
     59    uint64_t       upload;
    5760};
    5861
     
    7982    tc->bindPort = *(tor->bindPort);
    8083    tc->newPort  = -1;
     84
     85    tc->download = tor->downloaded;
     86    tc->upload   = tor->uploaded;
    8187
    8288    return tc;
     
    268274    uint64_t   left;
    269275    int        ret;
    270 
    271     if( tc->started && 0 < tc->newPort )
    272     {
    273         tc->bindPort = tc->newPort;
    274         tc->newPort = -1;
    275     }
    276 
     276    uint64_t   down;
     277    uint64_t   up;
     278
     279    down = tor->downloaded - tc->download;
     280    up = tor->uploaded - tc->upload;
    277281    if( tc->started )
     282    {
    278283        event = "&event=started";
     284        down = up = 0;
     285       
     286        if( 0 < tc->newPort )
     287        {
     288            tc->bindPort = tc->newPort;
     289            tc->newPort = -1;
     290        }
     291    }
    279292    else if( tc->completed )
     293    {
    280294        event = "&event=completed";
     295    }
    281296    else if( tc->stopped || 0 < tc->newPort )
     297    {
    282298        event = "&event=stopped";
     299    }
    283300    else
     301    {
    284302        event = "";
     303    }
    285304
    286305    left = tr_cpLeftBytes( tor->completion );
     
    303322            "Connection: close\r\n\r\n",
    304323            inf->trackerAnnounce, tor->hashString, tc->id,
    305             tc->bindPort, tor->uploaded, tor->downloaded,
     324            tc->bindPort, up, down,
    306325            left, tor->key, event, inf->trackerAddress,
    307326            VERSION_MAJOR, VERSION_MINOR );
  • trunk/libtransmission/transmission.c

    r210 r216  
    303303
    304304    tor->status  = TR_STATUS_CHECK;
    305     tor->tracker = tr_trackerInit( tor );
    306305
    307306    tor->date = tr_date();
     
    558557    tor->status = tr_cpIsSeeding( tor->completion ) ?
    559558                      TR_STATUS_SEED : TR_STATUS_DOWNLOAD;
     559    tor->tracker = tr_trackerInit( tor );
    560560
    561561    while( !tor->die )
Note: See TracChangeset for help on using the changeset viewer.