diff --git a/libtransmission/announcer.c b/libtransmission/announcer.c index 7cb620f1d..d4f78e93e 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.c @@ -316,6 +316,9 @@ trackerNew( tr_announcer * announcer, tracker->announce = tr_strdup( announce ); tracker->scrape = tr_strdup( scrape ); generateKeyParam( tracker->key_param, KEYLEN ); + tracker->seederCount = -1; + tracker->leecherCount = -1; + tracker->downloadCount = -1; return tracker; } diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index aa3df9b28..f7fd45808 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -1232,7 +1232,7 @@ void tr_torrentPeersFree( tr_peer_stat * peerStats, typedef struct { - /* how many downloads this tracker knows of */ + /* how many downloads this tracker knows of (-1 means it does not know) */ int downloadCount; /* whether or not we've ever sent this tracker an announcement */ @@ -1293,7 +1293,7 @@ typedef struct if "hasScraped" is false, this field is undefined */ time_t lastScrapeTime; - /* number of leechers this tracker knows of */ + /* number of leechers this tracker knows of (-1 means it does not know) */ int leecherCount; /* when the next periodic announce message will be sent out. @@ -1304,7 +1304,7 @@ typedef struct if "willScrape" is false, this field is undefined */ time_t nextScrapeTime; - /* number of seeders this tracker knows of */ + /* number of seeders this tracker knows of (-1 means it does not know) */ int seederCount; /* which tier this tracker is in */ diff --git a/macosx/TrackerCell.m b/macosx/TrackerCell.m index d8718f12b..ecc538578 100644 --- a/macosx/TrackerCell.m +++ b/macosx/TrackerCell.m @@ -134,20 +134,23 @@ NSMutableSet * fTrackerIconLoading; [nameString drawInRect: nameRect]; //count strings - NSString * seederBaseString = [NSLocalizedString(@"Seeders", "tracker peer stat") stringByAppendingFormat: @": %d", - [node totalSeeders]]; + NSString * seederBaseString = [NSLocalizedString(@"Seeders", "tracker peer stat") stringByAppendingFormat: @": %@", + [node totalSeeders] != -1 ? [NSString stringWithFormat: @"%d", [node totalSeeders]] + : NSLocalizedString(@"N/A", "tracker peer stat")]; NSAttributedString * seederString = [self attributedStatusWithString: seederBaseString color: statusColor]; const NSRect seederRect = [self rectForCountWithString: seederString withAboveRect: nameRect inBounds: cellFrame]; [seederString drawInRect: seederRect]; - NSString * leecherBaseString = [NSLocalizedString(@"Leechers", "tracker peer stat") stringByAppendingFormat: @": %d", - [node totalLeechers]]; + NSString * leecherBaseString = [NSLocalizedString(@"Leechers", "tracker peer stat") stringByAppendingFormat: @": %@", + [node totalLeechers] != -1 ? [NSString stringWithFormat: @"%d", [node totalLeechers]] + : NSLocalizedString(@"N/A", "tracker peer stat")]; NSAttributedString * leecherString = [self attributedStatusWithString: leecherBaseString color: statusColor]; const NSRect leecherRect = [self rectForCountWithString: leecherString withAboveRect: seederRect inBounds: cellFrame]; [leecherString drawInRect: leecherRect]; - NSString * downloadedBaseString = [NSLocalizedString(@"Downloaded", "tracker peer stat") stringByAppendingFormat: @": %d", - [node totalDownloaded]]; + NSString * downloadedBaseString = [NSLocalizedString(@"Downloaded", "tracker peer stat") stringByAppendingFormat: @": %@", + [node totalDownloaded] != -1 ? [NSString stringWithFormat: @"%d", [node totalDownloaded]] + : NSLocalizedString(@"N/A", "tracker peer stat")]; NSAttributedString * downloadedString = [self attributedStatusWithString: downloadedBaseString color: statusColor]; const NSRect downloadedRect = [self rectForCountWithString: downloadedString withAboveRect: leecherRect inBounds: cellFrame]; [downloadedString drawInRect: downloadedRect];