mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
if no webseeds, avoid some unneeded work when generating the list
This commit is contained in:
parent
7de86fd404
commit
d835f48828
1 changed files with 16 additions and 14 deletions
|
@ -890,26 +890,28 @@ int trashDataFile(const char * filename)
|
|||
|
||||
- (NSArray *) webSeeds
|
||||
{
|
||||
const NSInteger webSeedCount = fInfo->webseedCount;
|
||||
NSMutableArray * webSeeds = [NSMutableArray arrayWithCapacity: webSeedCount];
|
||||
NSMutableArray * webSeeds = [NSMutableArray arrayWithCapacity: fInfo->webseedCount];
|
||||
|
||||
float * dlSpeeds = tr_torrentWebSpeeds(fHandle);
|
||||
|
||||
for (NSInteger i = 0; i < webSeedCount; i++)
|
||||
if (fInfo->webseedCount > 0)
|
||||
{
|
||||
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 3];
|
||||
float * dlSpeeds = tr_torrentWebSpeeds(fHandle);
|
||||
|
||||
[dict setObject: [self name] forKey: @"Name"];
|
||||
[dict setObject: [NSString stringWithUTF8String: fInfo->webseeds[i]] forKey: @"Address"];
|
||||
for (NSInteger i = 0; i < fInfo->webseedCount; i++)
|
||||
{
|
||||
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 3];
|
||||
|
||||
[dict setObject: [self name] forKey: @"Name"];
|
||||
[dict setObject: [NSString stringWithUTF8String: fInfo->webseeds[i]] forKey: @"Address"];
|
||||
|
||||
if (dlSpeeds[i] != -1.0)
|
||||
[dict setObject: [NSNumber numberWithFloat: dlSpeeds[i]] forKey: @"DL From Rate"];
|
||||
|
||||
[webSeeds addObject: dict];
|
||||
}
|
||||
|
||||
if (dlSpeeds[i] != -1.0)
|
||||
[dict setObject: [NSNumber numberWithFloat: dlSpeeds[i]] forKey: @"DL From Rate"];
|
||||
|
||||
[webSeeds addObject: dict];
|
||||
tr_free(dlSpeeds);
|
||||
}
|
||||
|
||||
tr_free(dlSpeeds);
|
||||
|
||||
return webSeeds;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue