diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index 200df77..1681f2e 100644 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -60,17 +60,20 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele // PingServers.instance.ping() // let newInstance = PingTest.init(hostName: "www.baidu.com") // newInstance.start() - let SerMgr = ServerProfileManager.instance - let pingServerQueue : DispatchQueue = DispatchQueue.global(priority: DispatchQueue.GlobalQueuePriority.high) - for profile in SerMgr.profiles { - let host = profile.serverHost - - pingServerQueue.async(execute: { +// let SerMgr = ServerProfileManager.instance +// let pingServerQueue : DispatchQueue = DispatchQueue.global(priority: DispatchQueue.GlobalQueuePriority.high) +// +// for profile in SerMgr.profiles { +// let host = profile.serverHost +// +// pingServerQueue.async(execute: { // print(profile.serverHost) - let pingInstance = PingTest.init(hostName: host) - pingInstance.start() - })} +// SimplePingClient().pingHostname(host) { latency in +// print("-----------\(host) latency is \(latency ?? "fail")")} +//// let pingInstance = PingTest.init(hostName: host) +//// pingInstance.start() +// })} NSUserNotificationCenter.default.delegate = self // Prepare ss-local @@ -120,6 +123,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele } } self.updateServersMenu() + self.updateMainMenu() SyncSSLocal() } ) @@ -152,9 +156,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele } else if userInfo["source"] as! String == "url" { userNote.subtitle = "By Handle SS URL".localized } - userNote.informativeText = "Host: \(profile.serverHost)" - " Port: \(profile.serverPort)" - " Encription Method: \(profile.method)".localized + userNote.informativeText = "Host: \(profile.serverHost)\n Port: \(profile.serverPort)\n Encription Method: \(profile.method)".localized userNote.soundName = NSUserNotificationDefaultSoundName NSUserNotificationCenter.default diff --git a/ShadowsocksX-NG/PingClient.swift b/ShadowsocksX-NG/PingClient.swift index 4ad6cb1..189a742 100644 --- a/ShadowsocksX-NG/PingClient.swift +++ b/ShadowsocksX-NG/PingClient.swift @@ -94,8 +94,6 @@ class PingServers:NSObject{ } if i >= SerMgr.profiles.count{ - (NSApplication.shared().delegate as! AppDelegate).updateServersMenu() - (NSApplication.shared().delegate as! AppDelegate).updateRunningModeMenu() let notice = NSUserNotification() notice.title = "Ping测试完成!" notice.subtitle = "最快的是\(SerMgr.profiles[fastest_id].remark) \(SerMgr.profiles[fastest_id].serverHost) \(SerMgr.profiles[fastest_id].latency!)ms" @@ -117,6 +115,8 @@ class PingServers:NSObject{ self.fastest_id = i } } + (NSApplication.shared().delegate as! AppDelegate).updateServersMenu() + (NSApplication.shared().delegate as! AppDelegate).updateRunningModeMenu() } self.ping(i+1) diff --git a/ShadowsocksX-NG/ss-local b/ShadowsocksX-NG/ss-local index 1e5d4c2..12974e4 100755 Binary files a/ShadowsocksX-NG/ss-local and b/ShadowsocksX-NG/ss-local differ