From a77770a51a7987b40ec540e6717ffc4719fe0c9e Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 13 Jan 2010 22:40:07 +0000 Subject: [PATCH] (trunk) add tr_torrent_stat.id to RPC documentation. Rename tr_tracker_stat.identifier as tr_tracker_stat.id for consistency with tr_torrent.id --- doc/rpc-spec.txt | 7 ++++--- libtransmission/announcer.c | 2 +- libtransmission/metainfo.c | 7 ++++--- libtransmission/rpcimpl.c | 2 +- libtransmission/transmission.h | 2 +- macosx/Torrent.m | 8 ++++---- macosx/TrackerNode.m | 2 +- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/doc/rpc-spec.txt b/doc/rpc-spec.txt index 51d43823d..7ba4ed4a8 100644 --- a/doc/rpc-spec.txt +++ b/doc/rpc-spec.txt @@ -245,9 +245,10 @@ -------------------+--------------------------------------+ trackers | array of objects, each containing: | +-------------------------+------------+ - | announce | string | tr_info - | scrape | string | tr_info - | tier | number | tr_info + | announce | string | tr_tracker_info + | scrape | string | tr_tracker_info + | tier | number | tr_tracker_info + | id | number | tr_tracker_info -------------------+--------------------------------------+ trackerStats | array of objects, each containing: | +-------------------------+------------+ diff --git a/libtransmission/announcer.c b/libtransmission/announcer.c index 352149302..95a7fd5e1 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.c @@ -776,7 +776,7 @@ addTorrentToTier( tr_announcer * announcer, tr_torrent_tiers * tiers, tr_torrent tr_ptrArrayAppend( &tiers->tiers, tier ); } - tierAddTracker( announcer, tier, info->announce, info->scrape, info->identifier ); + tierAddTracker( announcer, tier, info->announce, info->scrape, info->id ); } } diff --git a/libtransmission/metainfo.c b/libtransmission/metainfo.c index e7d73f289..b1b06ba1c 100644 --- a/libtransmission/metainfo.c +++ b/libtransmission/metainfo.c @@ -1,5 +1,6 @@ /* * This file Copyright (C) 2009-2010 Mnemosyne LLC + trackers[trackerCount].id = 0; * * This file is licensed by the GPL version 2. Works owned by the * Transmission project are granted a special exemption to clause 2(b) @@ -294,7 +295,7 @@ getannounce( tr_info * inf, tr_benc * meta ) t->tier = validTiers; t->announce = tr_strdup( url ); t->scrape = tr_convertAnnounceToScrape( url ); - t->identifier = trackerCount; + t->id = trackerCount; anyAdded = TRUE; ++trackerCount; @@ -326,7 +327,7 @@ getannounce( tr_info * inf, tr_benc * meta ) trackers[trackerCount].tier = 0; trackers[trackerCount].announce = tr_strdup( url ); trackers[trackerCount].scrape = tr_convertAnnounceToScrape( url ); - trackers[trackerCount].identifier = 0; + trackers[trackerCount].id = 0; trackerCount++; /*fprintf( stderr, "single announce: [%s]\n", url );*/ } @@ -599,7 +600,7 @@ tr_metainfoSetFromMagnet( tr_info * inf, const tr_magnet_info * m ) inf->trackers[i].tier = i; inf->trackers[i].announce = tr_strdup( url ); inf->trackers[i].scrape = tr_convertAnnounceToScrape( url ); - inf->trackers[i].identifier = i; + inf->trackers[i].id = i; } } diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index 195a1d1eb..a2dd1190b 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -361,7 +361,7 @@ addTrackers( const tr_info * info, const tr_tracker_info * t = &info->trackers[i]; tr_benc * d = tr_bencListAddDict( trackers, 4 ); tr_bencDictAddStr( d, "announce", t->announce ); - tr_bencDictAddInt( d, "identifier", t->identifier ); + tr_bencDictAddInt( d, "id", t->id ); tr_bencDictAddStr( d, "scrape", t->scrape ); tr_bencDictAddInt( d, "tier", t->tier ); } diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 72bf66fd1..709d3e41f 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -1208,7 +1208,7 @@ typedef struct tr_tracker_info int tier; char * announce; char * scrape; - uint32_t identifier; /* used to match to a tr_tracker_stat */ + uint32_t id; /* unique identifier used to match to a tr_tracker_stat */ } tr_tracker_info; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 42f08dfea..7a801e482 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -631,12 +631,12 @@ int trashDataFile(const char * filename) for (NSUInteger i=0; i < oldTrackerCount; ++i) { trackerStructs[i] = fInfo->trackers[i]; - trackerStructs[i].identifier = i; + trackerStructs[i].id = i; } trackerStructs[oldTrackerCount].announce = (char *)[tracker UTF8String]; trackerStructs[oldTrackerCount].tier = trackerStructs[oldTrackerCount-1].tier + 1; - trackerStructs[oldTrackerCount].identifier = oldTrackerCount; + trackerStructs[oldTrackerCount].id = oldTrackerCount; const BOOL success = tr_torrentSetAnnounceList(fHandle, trackerStructs, oldTrackerCount+1); tr_free(trackerStructs); @@ -652,10 +652,10 @@ int trashDataFile(const char * filename) NSUInteger newCount = 0; for (NSUInteger i = 0; i < fInfo->trackerCount; i++) { - if (![removeIdentifiers containsIndex: fInfo->trackers[i].identifier]) + if (![removeIdentifiers containsIndex: fInfo->trackers[i].id]) { trackerStructs[newCount] = fInfo->trackers[i]; - trackerStructs[newCount].identifier = newCount++; + trackerStructs[newCount].id = newCount++; } } diff --git a/macosx/TrackerNode.m b/macosx/TrackerNode.m index d211cc644..f21dc761b 100644 --- a/macosx/TrackerNode.m +++ b/macosx/TrackerNode.m @@ -66,7 +66,7 @@ - (NSUInteger) identifier { - return fStat.identifier; + return fStat.id; } - (NSInteger) totalSeeders -- 2.40.0