mirror of
https://github.com/transmission/transmission
synced 2025-02-20 13:16:53 +00:00
for scrapes: add a new field to distinguish from error messages returned from the tracker, and scrape timeouts, so that they can be displayed differently
This commit is contained in:
parent
ed032ec4de
commit
bd635f22d0
6 changed files with 18 additions and 2 deletions
|
@ -1357,6 +1357,7 @@ printDetails( tr_benc * top )
|
|||
tr_bool lastScrapeSucceeded;
|
||||
int64_t lastScrapeStartTime;
|
||||
int64_t lastScrapeTime;
|
||||
tr_bool lastScrapeTimedOut;
|
||||
int64_t leecherCount;
|
||||
int64_t nextAnnounceTime;
|
||||
int64_t nextScrapeTime;
|
||||
|
@ -1382,6 +1383,7 @@ printDetails( tr_benc * top )
|
|||
tr_bencDictFindInt ( t, "lastScrapeStartTime", &lastScrapeStartTime ) &&
|
||||
tr_bencDictFindBool( t, "lastScrapeSucceeded", &lastScrapeSucceeded ) &&
|
||||
tr_bencDictFindInt ( t, "lastScrapeTime", &lastScrapeTime ) &&
|
||||
tr_bencDictFindBool( t, "lastScrapeTimedOut", &lastScrapeTimedOut ) &&
|
||||
tr_bencDictFindInt ( t, "leecherCount", &leecherCount ) &&
|
||||
tr_bencDictFindInt ( t, "nextAnnounceTime", &nextAnnounceTime ) &&
|
||||
tr_bencDictFindInt ( t, "nextScrapeTime", &nextScrapeTime ) &&
|
||||
|
@ -1436,6 +1438,8 @@ printDetails( tr_benc * top )
|
|||
if( lastScrapeSucceeded )
|
||||
printf( " Tracker had %'d seeders and %'d leechers %s ago\n",
|
||||
(int)seederCount, (int)leecherCount, buf );
|
||||
else if( lastScrapeTimedOut )
|
||||
printf( " Tracker scrape timed out; will retry\n" );
|
||||
else
|
||||
printf( " Got a scrape error \"%s\" %s ago\n",
|
||||
lastScrapeResult, buf );
|
||||
|
|
|
@ -272,6 +272,7 @@
|
|||
| lastScrapeStartTime | number | tr_tracker_stat
|
||||
| lastScrapeSucceeded | boolean | tr_tracker_stat
|
||||
| lastScrapeTime | number | tr_tracker_stat
|
||||
| lastScrapeTimedOut | boolean | tr_tracker_stat
|
||||
| leecherCount | number | tr_tracker_stat
|
||||
| nextAnnounceTime | number | tr_tracker_stat
|
||||
| nextScrapeTime | number | tr_tracker_stat
|
||||
|
@ -582,3 +583,5 @@
|
|||
| | yes | session-get | new arg "config-dir"
|
||||
| | yes | torrent-add | new arg "bandwidthPriority"
|
||||
| | yes | torrent-get | new trackerStats arg "lastAnnounceTimedOut"
|
||||
------+---------+-----------+----------------+-------------------------------
|
||||
8 | 1.92 | yes | torrent-get | new trackerStats arg "lastScrapeTimedOut"
|
||||
|
|
|
@ -377,6 +377,7 @@ typedef struct
|
|||
time_t lastScrapeStartTime;
|
||||
time_t lastScrapeTime;
|
||||
tr_bool lastScrapeSucceeded;
|
||||
tr_bool lastScrapeTimedOut;
|
||||
|
||||
time_t announceAt;
|
||||
time_t manualAnnounceAllowedAt;
|
||||
|
@ -1714,6 +1715,7 @@ onScrapeDone( tr_session * session,
|
|||
}
|
||||
|
||||
tier->lastScrapeSucceeded = success;
|
||||
tier->lastScrapeTimedOut = responseCode == 0;
|
||||
|
||||
if( success && tier->currentTracker->host )
|
||||
tier->currentTracker->host->lastSuccessfulRequest = now;
|
||||
|
@ -1959,6 +1961,7 @@ tr_announcerStats( const tr_torrent * torrent,
|
|||
if(( st->hasScraped = tier->lastScrapeTime != 0 )) {
|
||||
st->lastScrapeTime = tier->lastScrapeTime;
|
||||
st->lastScrapeSucceeded = tier->lastScrapeSucceeded;
|
||||
st->lastScrapeTimedOut = tier->lastScrapeTimedOut;
|
||||
tr_strlcpy( st->lastScrapeResult, tier->lastScrapeStr, sizeof( st->lastScrapeResult ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ addTrackerStats( const tr_tracker_stat * st, int n, tr_benc * list )
|
|||
for( i=0; i<n; ++i )
|
||||
{
|
||||
const tr_tracker_stat * s = &st[i];
|
||||
tr_benc * d = tr_bencListAddDict( list, 24 );
|
||||
tr_benc * d = tr_bencListAddDict( list, 25 );
|
||||
tr_bencDictAddStr ( d, "announce", s->announce );
|
||||
tr_bencDictAddInt ( d, "announceState", s->announceState );
|
||||
tr_bencDictAddInt ( d, "downloadCount", s->downloadCount );
|
||||
|
@ -400,6 +400,7 @@ addTrackerStats( const tr_tracker_stat * st, int n, tr_benc * list )
|
|||
tr_bencDictAddInt ( d, "lastScrapeStartTime", s->lastScrapeStartTime );
|
||||
tr_bencDictAddBool( d, "lastScrapeSucceeded", s->lastScrapeSucceeded );
|
||||
tr_bencDictAddInt ( d, "lastScrapeTime", s->lastScrapeTime );
|
||||
tr_bencDictAddInt ( d, "lastScrapeTimedOut", s->lastScrapeTimedOut );
|
||||
tr_bencDictAddInt ( d, "leecherCount", s->leecherCount );
|
||||
tr_bencDictAddInt ( d, "nextAnnounceTime", s->nextAnnounceTime );
|
||||
tr_bencDictAddInt ( d, "nextScrapeTime", s->nextScrapeTime );
|
||||
|
|
|
@ -1447,6 +1447,9 @@ typedef struct
|
|||
if "hasAnnounced" is false, this field is undefined */
|
||||
tr_bool lastScrapeSucceeded;
|
||||
|
||||
/* whether or not the last scrape timed out. */
|
||||
tr_bool lastScrapeTimedOut;
|
||||
|
||||
/* when the last scrape was completed.
|
||||
if "hasScraped" is false, this field is undefined */
|
||||
time_t lastScrapeTime;
|
||||
|
|
|
@ -182,7 +182,9 @@
|
|||
dateString = NSLocalizedString(@"N/A", "Tracker last scrape");
|
||||
|
||||
NSString * baseString;
|
||||
if (fStat.hasScraped && !fStat.lastScrapeSucceeded)
|
||||
if (fStat.hasScraped && fStat.lastScrapeTimedOut)
|
||||
baseString = [NSLocalizedString(@"Scrape timed out", "Tracker last scrape") stringByAppendingFormat: @": %@", dateString];
|
||||
else if (fStat.hasScraped && !fStat.lastScrapeSucceeded)
|
||||
{
|
||||
baseString = NSLocalizedString(@"Scrape error", "Tracker last scrape");
|
||||
|
||||
|
|
Loading…
Reference in a new issue