(trunk) copy-by-value changes to tr_tracker_stat

This commit is contained in:
Charles Kerr 2009-09-26 03:36:58 +00:00
parent 5b46b63b23
commit 28e119c1bb
4 changed files with 10 additions and 9 deletions

View File

@ -254,6 +254,7 @@
-------------------+--------------------------------------+
trackerStats | array of objects, each containing: |
+-------------------------+------------+
| announce | string | tr_tracker_stat
| downloadCount | number | tr_tracker_stat
| hasAnnounced | boolean | tr_tracker_stat
| hasScraped | boolean | tr_tracker_stat

View File

@ -1643,7 +1643,8 @@ tr_announcerStats( const tr_torrent * torrent,
const tr_tracker_item * tracker = tr_ptrArrayNth( (tr_ptrArray*)&tier->trackers, j );
tr_tracker_stat * st = ret + out++;
st->host = tr_strdup( tracker->host->name );
tr_strlcpy( st->host, tracker->host->name, sizeof( st->host ) );
tr_strlcpy( st->announce, tracker->announce, sizeof( st->announce ) );
st->tier = i + 1;
st->isActive = tracker == tier->currentTracker;
st->lastScrapeStartTime = tier->lastScrapeStartTime;
@ -1679,10 +1680,7 @@ tr_announcerStats( const tr_torrent * torrent,
void
tr_announcerStatsFree( tr_tracker_stat * trackers,
int trackerCount )
int trackerCount UNUSED )
{
int i;
for( i=0; i<trackerCount; ++i )
tr_free( trackers[i].host );
tr_free( trackers );
}

View File

@ -374,7 +374,8 @@ 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, 23 );
tr_benc * d = tr_bencListAddDict( list, 24 );
tr_bencDictAddStr ( d, "announce", s->announce );
tr_bencDictAddInt ( d, "downloadCount", s->downloadCount );
tr_bencDictAddBool( d, "hasAnnounced", s->hasAnnounced );
tr_bencDictAddBool( d, "hasScraped", s->hasScraped );
@ -653,8 +654,6 @@ torrentGet( tr_session * session,
else for( i = 0; i < torrentCount; ++i )
addInfo( torrents[i], tr_bencListAdd( list ), fields );
fprintf( stderr, "%s\n", tr_bencToStr( args_out, TR_FMT_JSON, NULL ) );
tr_free( torrents );
return msg;
}

View File

@ -1242,7 +1242,10 @@ typedef struct
tr_bool hasScraped;
/* ex: legaltorrents.com */
char * host;
char host[1024];
/* the full announce URL */
char announce[1024];
/* true if we're trying to use this tracker.
Transmission typically uses one tracker per tier. */