1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

retrieve peers and webseeds in a single loop

This commit is contained in:
Mitchell Livingston 2010-02-07 01:51:45 +00:00
parent 95a4adfd22
commit 7de86fd404
2 changed files with 15 additions and 16 deletions

View file

@ -1265,6 +1265,7 @@ typedef enum
fTrackers = nil;
[fTrackerTable setTrackers: nil];
[fTrackerTable deselectAll: self];
[fTrackerTable reloadData];
}
@ -1554,12 +1555,18 @@ typedef enum
else
[fPeers removeAllObjects];
if (!fWebSeeds)
fWebSeeds = [[NSMutableArray alloc] init];
else
[fWebSeeds removeAllObjects];
NSUInteger known = 0, connected = 0, tracker = 0, incoming = 0, cache = 0, pex = 0, dht = 0, ltep = 0,
toUs = 0, fromUs = 0;
BOOL anyActive = false;
for (Torrent * torrent in fTorrents)
{
[fPeers addObjectsFromArray: [torrent peers]];
[fWebSeeds addObjectsFromArray: [torrent webSeeds]];
known += [torrent totalPeersKnown];
@ -1583,6 +1590,12 @@ typedef enum
}
}
[fPeers sortUsingDescriptors: [self peerSortDescriptors]];
[fPeerTable reloadData];
[fWebSeeds sortUsingDescriptors: [fWebSeedTable sortDescriptors]];
[fWebSeedTable reloadData];
NSString * knownString = [NSString stringWithFormat: NSLocalizedString(@"%d known", "Inspector -> Peers tab -> peers"), known];
if (anyActive)
{
@ -1639,20 +1652,6 @@ typedef enum
NSString * connectedText = [NSString stringWithFormat: @"%@\n%@", activeString, knownString];
[fConnectedPeersField setStringValue: connectedText];
}
[fPeers sortUsingDescriptors: [self peerSortDescriptors]];
[fPeerTable reloadData];
if (!fWebSeeds)
fWebSeeds = [[NSMutableArray alloc] init];
else
[fWebSeeds removeAllObjects];
for (Torrent * torrent in fTorrents)
[fWebSeeds addObjectsFromArray: [torrent webSeeds]];
[fWebSeeds sortUsingDescriptors: [fWebSeedTable sortDescriptors]];
[fWebSeedTable reloadData];
}
- (void) updateInfoFiles

View file

@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="6"/>
<integer value="72"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -715,7 +715,7 @@ AAAAAAAAAAAAAAAAAAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSwgSW5jLiwgMjAxMAA</bytes>
<bool key="NSEnabled">YES</bool>
<object class="NSSearchFieldCell" key="NSCell" id="788421673">
<int key="NSCellFlags">343014976</int>
<int key="NSCellFlags2">268436544</int>
<int key="NSCellFlags2">268436480</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="42108294"/>
<string key="NSPlaceholderString">Filter</string>