mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
retrieve peers and webseeds in a single loop
This commit is contained in:
parent
95a4adfd22
commit
7de86fd404
2 changed files with 15 additions and 16 deletions
|
@ -1265,6 +1265,7 @@ typedef enum
|
||||||
fTrackers = nil;
|
fTrackers = nil;
|
||||||
|
|
||||||
[fTrackerTable setTrackers: nil];
|
[fTrackerTable setTrackers: nil];
|
||||||
|
[fTrackerTable deselectAll: self];
|
||||||
[fTrackerTable reloadData];
|
[fTrackerTable reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1554,12 +1555,18 @@ typedef enum
|
||||||
else
|
else
|
||||||
[fPeers removeAllObjects];
|
[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,
|
NSUInteger known = 0, connected = 0, tracker = 0, incoming = 0, cache = 0, pex = 0, dht = 0, ltep = 0,
|
||||||
toUs = 0, fromUs = 0;
|
toUs = 0, fromUs = 0;
|
||||||
BOOL anyActive = false;
|
BOOL anyActive = false;
|
||||||
for (Torrent * torrent in fTorrents)
|
for (Torrent * torrent in fTorrents)
|
||||||
{
|
{
|
||||||
[fPeers addObjectsFromArray: [torrent peers]];
|
[fPeers addObjectsFromArray: [torrent peers]];
|
||||||
|
[fWebSeeds addObjectsFromArray: [torrent webSeeds]];
|
||||||
|
|
||||||
known += [torrent totalPeersKnown];
|
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];
|
NSString * knownString = [NSString stringWithFormat: NSLocalizedString(@"%d known", "Inspector -> Peers tab -> peers"), known];
|
||||||
if (anyActive)
|
if (anyActive)
|
||||||
{
|
{
|
||||||
|
@ -1639,20 +1652,6 @@ typedef enum
|
||||||
NSString * connectedText = [NSString stringWithFormat: @"%@\n%@", activeString, knownString];
|
NSString * connectedText = [NSString stringWithFormat: @"%@\n%@", activeString, knownString];
|
||||||
[fConnectedPeersField setStringValue: connectedText];
|
[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
|
- (void) updateInfoFiles
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<integer value="6"/>
|
<integer value="72"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
@ -715,7 +715,7 @@ AAAAAAAAAAAAAAAAAAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSwgSW5jLiwgMjAxMAA</bytes>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
<object class="NSSearchFieldCell" key="NSCell" id="788421673">
|
<object class="NSSearchFieldCell" key="NSCell" id="788421673">
|
||||||
<int key="NSCellFlags">343014976</int>
|
<int key="NSCellFlags">343014976</int>
|
||||||
<int key="NSCellFlags2">268436544</int>
|
<int key="NSCellFlags2">268436480</int>
|
||||||
<string key="NSContents"/>
|
<string key="NSContents"/>
|
||||||
<reference key="NSSupport" ref="42108294"/>
|
<reference key="NSSupport" ref="42108294"/>
|
||||||
<string key="NSPlaceholderString">Filter</string>
|
<string key="NSPlaceholderString">Filter</string>
|
||||||
|
|
Loading…
Reference in a new issue