(libT) #1179: when creating a torrent, don't add an announce-list if there's only one tracker

This commit is contained in:
Charles Kerr 2008-08-11 17:29:53 +00:00
parent 17cde72891
commit 05e80bea43
1 changed files with 10 additions and 8 deletions

View File

@ -361,16 +361,18 @@ tr_realMakeMetaInfo ( tr_metainfo_builder * builder )
{ {
int prevTier = -1; int prevTier = -1;
tr_benc * tier = NULL; tr_benc * tier = NULL;
tr_benc * announceList;
announceList = tr_bencDictAddList( &top, "announce-list", 0 ); if( builder->trackerCount > 1 )
{
tr_benc * annList = tr_bencDictAddList( &top, "announce-list", 0 );
for( i=0; i<builder->trackerCount; ++i ) { for( i=0; i<builder->trackerCount; ++i ) {
if( prevTier != builder->trackers[i].tier ) { if( prevTier != builder->trackers[i].tier ) {
prevTier = builder->trackers[i].tier; prevTier = builder->trackers[i].tier;
tier = tr_bencListAddList( announceList, 0 ); tier = tr_bencListAddList( annList, 0 );
} }
tr_bencListAddStr( tier, builder->trackers[i].announce ); tr_bencListAddStr( tier, builder->trackers[i].announce );
} }
}
tr_bencDictAddStr( &top, "announce", builder->trackers[0].announce ); tr_bencDictAddStr( &top, "announce", builder->trackers[0].announce );
} }