From 7de86fd404a4a5c9c6650bd5485d5f10747c00a4 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 7 Feb 2010 01:51:45 +0000 Subject: [PATCH] retrieve peers and webseeds in a single loop --- macosx/InfoWindowController.m | 27 +++++++++++++-------------- macosx/MessageWindow.xib | 4 ++-- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 0f5df8400..ec2260761 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -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 diff --git a/macosx/MessageWindow.xib b/macosx/MessageWindow.xib index c7e649bea..9a5d114f5 100644 --- a/macosx/MessageWindow.xib +++ b/macosx/MessageWindow.xib @@ -12,7 +12,7 @@ YES - + YES @@ -715,7 +715,7 @@ AAAAAAAAAAAAAAAAAAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSwgSW5jLiwgMjAxMAA YES 343014976 - 268436544 + 268436480 Filter