mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-14 02:27:38 -07:00
Only poll the ZeroTier service when the menu or Network List are visible. Reduces CPU idle prevention by a a LOT
This commit is contained in:
parent
b9a4d138fc
commit
78e5a00a68
3 changed files with 27 additions and 5 deletions
|
@ -21,7 +21,14 @@ class NetworkMonitor: NSObject {
|
|||
|
||||
override init() {
|
||||
super.init()
|
||||
}
|
||||
|
||||
deinit {
|
||||
timer?.invalidate()
|
||||
}
|
||||
|
||||
func start() {
|
||||
NSLog("ZeroTier monitor started")
|
||||
timer = NSTimer.scheduledTimerWithTimeInterval(1.0,
|
||||
target: self,
|
||||
selector: #selector(updateNetworkInfo),
|
||||
|
@ -29,8 +36,11 @@ class NetworkMonitor: NSObject {
|
|||
repeats: true)
|
||||
}
|
||||
|
||||
deinit {
|
||||
|
||||
func stop() {
|
||||
NSLog("ZeroTier monitor stopped")
|
||||
timer?.invalidate()
|
||||
timer = nil
|
||||
}
|
||||
|
||||
private func dataFile() -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue