Changeset 5902


Ignore:
Timestamp:
May 22, 2008, 4:59:51 PM (14 years ago)
Author:
charles
Message:

make tr_stat identical in transmission.h and rpc-spec.txt.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/rpc-spec.txt

    r5880 r5902  
    88   The JSON terminology in RFC 4627 is used. "array" is equivalent
    99   to a benc list; "object" is equivalent to a benc dictionary;
    10    an object's "keys" are the dictionary's string keys,
    11    and an object's "members" are its key/value pairs.
     10   and an object's "keys" are the dictionary's string keys.
    1211
    13122.  Message Format
     
    2726
    2827   (1) A required "method" string telling the name of the method to invoke
    29    (2) An optional "arguments" object of name/value pairs
    30    (3) An optional "tag" integer used for clients to track responses.
     28   (2) An optional "arguments" object of key/value pairs
     29   (3) An optional "tag" integer used by clients to track responses.
    3130       If provided by a request, the response MUST include the same tag.
    3231
     
    3736   (1) A required "result" string whose value must be "success" on success,
    3837       or an error string on failure.
    39    (2) An optional "arguments" object of name/value pairs
     38   (2) An optional "arguments" object of key/value pairs
    4039   (3) An optional "tag" integer as described in 2.1.
    4140
    42 2.3.  Request IPC Notation
    43 
    44    As a convenience, a casual URI notation is supported for requests via the
    45    query portion of a URI.  The advantage of this is that all current requests
     412.3.  Request URL Query Notation
     42
     43   As a convenience, a casual notation is supported for requests via the
     44   query portion of a URL.  The advantage of this is that all current requests
    4645   can be invoked via a very simple http GET request.  The possible future
    4746   disadvantage is that it limits nesting and listing structured requests.
     
    9897   (2) tr_info's "hash" field is omitted.
    9998   (3) tr_info's "pieces" field is omitted.
    100    (4) tr_file's "firstPiece", "lastPiece", and "offset" fields are omitted.
     99   (4) tr_file's only included pieces are "name" and "length".
    101100
    102101   Note that this is a fairly high-bandwidth request and that its results
     
    144143   Request arguments: 3.1's optional "ids" argument.
    145144
    146    Response arguments: "torrent-status", an array of objects based
    147    on libtransmission's tr_stat struct but differerent in the
    148    following ways:
    149 
    150    (1) the torrent's "id" field is added.
    151    (2) tr_info's "name" field is added.
    152    (3) tr_stat's "tracker" field is omitted, and is instead
    153        replaced with two strings: "announce-url" and scrape-url"
     145   Response arguments: "torrent-status", an array of objects
     146   identical to libtransmission's tr_stat struct.
    154147
    1551483.5.  Adding a Torrent
     
    173166                       form of one of 3.3's tr_info objects.
    174167
    175 3.6.  Other torrent settings
     1683.6.  Other Torrent Settings
    176169
    177170   Common arguments:
     
    196189   Request arguments: none
    197190   Response arguments: A "torrents" list of objects containing all
    198                        of 3.6's arguments plus the torrent's "id" int.
     191                       of 3.6's arguments plus the torrent's "id" field.
    199192                     
    200193
  • trunk/libtransmission/rpc.c

    r5880 r5902  
    168168        const int * f = st->peersFrom;
    169169        const struct tr_tracker_stat * s = &st->trackerStat;
    170         tr_benc * d = tr_bencListAddDict( list, 33 );
     170        tr_benc * d = tr_bencListAddDict( list, 35 );
    171171        tr_benc * t;
    172172
    173173        tr_bencDictAddInt( d, "activityDate", st->activityDate );
     174        tr_bencDictAddStr( d, "announceURL", st->announceURL );
    174175        tr_bencDictAddInt( d, "completedFromTracker", st->completedFromTracker );
    175176        tr_bencDictAddInt( d, "corruptEver", st->corruptEver );
     
    181182        tr_bencDictAddInt( d, "haveUnchecked", st->haveUnchecked );
    182183        tr_bencDictAddInt( d, "haveValid", st->haveValid );
    183         tr_bencDictAddInt( d, "id", tr_torrentId( tor ) );
     184        tr_bencDictAddInt( d, "id", st->id );
    184185        tr_bencDictAddInt( d, "leechers", st->leechers );
    185186        tr_bencDictAddInt( d, "leftUntilDone", st->leftUntilDone );
    186187        tr_bencDictAddInt( d, "manualAnnounceTime", st->manualAnnounceTime );
    187         tr_bencDictAddStr( d, "name", tor->info.name );
    188188        tr_bencDictAddInt( d, "peersConnected", st->peersConnected );
    189189        t = tr_bencDictAddDict( d, "peersFrom", 4 );
     
    201201        tr_bencDictAddDouble( d, "ratio", st->ratio );
    202202        tr_bencDictAddDouble( d, "recheckProgress", st->recheckProgress );
     203        tr_bencDictAddStr( d, "scrapeURL", st->scrapeURL );
    203204        tr_bencDictAddInt( d, "seeders", st->seeders );
    204205        tr_bencDictAddInt( d, "sizeWhenDone", st->sizeWhenDone );
     
    232233    {
    233234        const tr_file * file = &info->files[i];
    234         tr_benc * d = tr_bencListAddDict( files, 4 );
    235         tr_bencDictAddInt( d, "dnd", file->dnd );
     235        tr_benc * d = tr_bencListAddDict( files, 2 );
    236236        tr_bencDictAddInt( d, "length", file->length );
    237237        tr_bencDictAddStr( d, "name", file->name );
    238         tr_bencDictAddInt( d, "priority", file->priority );
    239238    }
    240239}
  • trunk/libtransmission/torrent.c

    r5880 r5902  
    687687    tr_stat * s;
    688688    struct tr_tracker * tc;
     689    const tr_tracker_info * ti;
    689690
    690691    if( !tor )
     
    696697
    697698    s = &tor->stats;
     699    s->id = tor->uniqueId;
    698700    s->status = tr_torrentGetStatus( tor );
    699701    s->error  = tor->error;
     
    702704
    703705    tc = tor->tracker;
    704     s->tracker = tr_trackerGetAddress( tor->tracker );
    705 
    706     tr_trackerStat( tor->tracker, &s->trackerStat );
     706    ti = tr_trackerGetAddress( tor->tracker );
     707    s->announceURL = ti ? ti->announce : NULL;
     708    s->scrapeURL   = ti ? ti->scrape   : NULL;
     709    tr_trackerStat( tc, &s->trackerStat );
     710    tr_trackerGetCounts( tc, &s->completedFromTracker,
     711                             &s->leechers,
     712                             &s->seeders );
    707713
    708714    tr_peerMgrTorrentStats( tor->handle->peerMgr,
     
    726732
    727733    tr_torrentGetRates( tor, &s->rateDownload, &s->rateUpload );
    728    
    729     tr_trackerGetCounts( tc,
    730                          &s->completedFromTracker,
    731                          &s->leechers,
    732                          &s->seeders );
    733734
    734735    s->swarmSpeed = tr_rcRate( tor->swarmSpeed );
  • trunk/libtransmission/transmission.h

    r5900 r5902  
    901901struct tr_stat
    902902{
     903    int id;
     904
    903905    tr_torrent_status status;
    904906
    905907    struct tr_tracker_stat trackerStat;
    906     const tr_tracker_info * tracker;
     908
     909    char * announceURL;
     910    char * scrapeURL;
    907911
    908912    tr_errno error;
  • trunk/macosx/Torrent.m

    r5868 r5902  
    724724- (NSString *) trackerAddressAnnounce
    725725{
    726     return fStat->tracker->announce ? [NSString stringWithUTF8String: fStat->tracker->announce] : nil;
     726    return fStat->announceURL ? [NSString stringWithUTF8String: fStat->announceURL] : nil;
    727727}
    728728
     
    750750- (NSString *) trackerAddressScrape
    751751{
    752     return fStat->tracker->scrape ? [NSString stringWithUTF8String: fStat->tracker->scrape] : nil;
     752    return fStat->scrapeURL ? [NSString stringWithUTF8String: fStat->scrapeURL] : nil;
    753753}
    754754
Note: See TracChangeset for help on using the changeset viewer.