mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 22:50:05 +08:00
optimize traffic
This commit is contained in:
parent
c5b66e58fa
commit
5d75cbacd4
@ -44,7 +44,7 @@ class ProxyInstance(profile: ProxyEntity, var service: BaseService.Interface? =
|
||||
|
||||
override fun launch() {
|
||||
box.setAsMain()
|
||||
super.launch()
|
||||
super.launch() // start box
|
||||
runOnDefaultDispatcher {
|
||||
looper = service?.let { TrafficLooper(it.data, this) }
|
||||
looper?.start()
|
||||
|
||||
@ -93,8 +93,11 @@ class TrafficLooper
|
||||
val itemBypass = TrafficUpdater.TrafficLooperData(tag = TAG_BYPASS)
|
||||
|
||||
while (sc.isActive) {
|
||||
proxy = data.proxy
|
||||
if (proxy == null) {
|
||||
delay(delayMs)
|
||||
proxy = data.proxy ?: continue
|
||||
continue
|
||||
}
|
||||
|
||||
if (trafficUpdater == null) {
|
||||
if (!proxy.isInitialized()) continue
|
||||
@ -175,6 +178,8 @@ class TrafficLooper
|
||||
data.notification?.apply {
|
||||
if (listenPostSpeed) postNotificationSpeedUpdate(speed)
|
||||
}
|
||||
|
||||
delay(delayMs)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user