From 92e06acf748fafaa9b2af57f0734b18a4eec967e Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 1 Sep 2010 20:54:04 +0000 Subject: [PATCH] (trunk) RPC: add "scrape" to the trackerStats array, making it a proper superset of the "trackers" array. Also, very minor tweaks to the RPC spec --- extras/rpc-spec.txt | 10 +++++----- libtransmission/announcer.c | 1 + libtransmission/rpcimpl.c | 3 ++- libtransmission/transmission.h | 11 +++++++---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/extras/rpc-spec.txt b/extras/rpc-spec.txt index bed1c9f87..72ddbe968 100644 --- a/extras/rpc-spec.txt +++ b/extras/rpc-spec.txt @@ -104,9 +104,9 @@ "seedIdleMode" | number which seeding inactivity to use. See tr_inactvelimit "seedRatioLimit" | double torrent-level seeding ratio "seedRatioMode" | number which ratio to use. See tr_ratiolimit - "trackerAdd" | array strings of URLs to add - "trackerRemove" | array strings of URLs to remove - "trackerReplace" | array pairs of old/new announce URLs + "trackerAdd" | array strings of announce URLs to add + "trackerRemove" | array strings of announce URLs to remove + "trackerReplace" | array pairs of old/new announce announce URLs "uploadLimit" | number maximum upload speed (KBps) "uploadLimited" | boolean true if "uploadLimit" is honored @@ -208,7 +208,6 @@ -------------------+--------+-----------------------------+ files | array of objects, each containing: | +-------------------------+------------+ - | key | type | | bytesCompleted | number | tr_torrent | length | number | tr_info | name | string | tr_info @@ -261,9 +260,9 @@ trackers | array of objects, each containing: | +-------------------------+------------+ | announce | string | tr_tracker_info + | id | number | tr_tracker_info | scrape | string | tr_tracker_info | tier | number | tr_tracker_info - | id | number | tr_tracker_info -------------------+--------------------------------------+ trackerStats | array of objects, each containing: | +-------------------------+------------+ @@ -289,6 +288,7 @@ | leecherCount | number | tr_tracker_stat | nextAnnounceTime | number | tr_tracker_stat | nextScrapeTime | number | tr_tracker_stat + | scrape | string | tr_tracker_stat | scrapeState | number | tr_tracker_stat | seederCount | number | tr_tracker_stat | tier | number | tr_tracker_stat diff --git a/libtransmission/announcer.c b/libtransmission/announcer.c index c69e65e73..261a11c97 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.c @@ -1993,6 +1993,7 @@ tr_announcerStats( const tr_torrent * torrent, st->id = tracker->id; tr_strlcpy( st->host, tracker->host->name, sizeof( st->host ) ); tr_strlcpy( st->announce, tracker->announce, sizeof( st->announce ) ); + tr_strlcpy( st->scrape, tracker->scrape, sizeof( st->scrape ) ); st->tier = i; st->isBackup = tracker != tier->currentTracker; st->lastScrapeStartTime = tier->lastScrapeStartTime; diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index 11ac2531e..e0cb4c539 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -386,7 +386,7 @@ addTrackerStats( const tr_tracker_stat * st, int n, tr_benc * list ) for( i=0; iannounce ); tr_bencDictAddInt ( d, "announceState", s->announceState ); tr_bencDictAddInt ( d, "downloadCount", s->downloadCount ); @@ -409,6 +409,7 @@ addTrackerStats( const tr_tracker_stat * st, int n, tr_benc * list ) tr_bencDictAddInt ( d, "leecherCount", s->leecherCount ); tr_bencDictAddInt ( d, "nextAnnounceTime", s->nextAnnounceTime ); tr_bencDictAddInt ( d, "nextScrapeTime", s->nextScrapeTime ); + tr_bencDictAddStr ( d, "scrape", s->scrape ); tr_bencDictAddInt ( d, "scrapeState", s->scrapeState ); tr_bencDictAddInt ( d, "seederCount", s->seederCount ); tr_bencDictAddInt ( d, "tier", s->tier ); diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 66cf84431..b218c333e 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -1472,18 +1472,18 @@ typedef enum { /* we won't (announce,scrape) this torrent to this tracker because * the torrent is stopped, or because of an error, or whatever */ - TR_TRACKER_INACTIVE, + TR_TRACKER_INACTIVE = 0, /* we will (announce,scrape) this torrent to this tracker, and are * waiting for enough time to pass to satisfy the tracker's interval */ - TR_TRACKER_WAITING, + TR_TRACKER_WAITING = 1, /* it's time to (announce,scrape) this torrent, and we're waiting on a * a free slot to open up in the announce manager */ - TR_TRACKER_QUEUED, + TR_TRACKER_QUEUED = 2, /* we're (announcing,scraping) this torrent right now */ - TR_TRACKER_ACTIVE + TR_TRACKER_ACTIVE = 3 } tr_tracker_state; @@ -1504,6 +1504,9 @@ typedef struct /* the full announce URL */ char announce[1024]; + /* the full scrape URL */ + char scrape[1024]; + /* Transmission uses one tracker per tier, * and the others are kept as backups */ tr_bool isBackup;