@@ -4,6 +4,10 @@ import android.net.Network
44import android.os.Build
55import io.nekohasekai.libbox.InterfaceUpdateListener
66import io.nekohasekai.sfa.Application
7+ import io.nekohasekai.sfa.BuildConfig
8+ import kotlinx.coroutines.Dispatchers
9+ import kotlinx.coroutines.GlobalScope
10+ import kotlinx.coroutines.launch
711import java.net.NetworkInterface
812
913object DefaultNetworkMonitor {
@@ -55,12 +59,25 @@ object DefaultNetworkMonitor {
5559 Thread .sleep(100 )
5660 continue
5761 }
58- listener.updateDefaultInterface(interfaceName, interfaceIndex)
62+ // TODO: remove launch after fixed
63+ // https://github.com/golang/go/issues/68760
64+ if (BuildConfig .DEBUG ) {
65+ GlobalScope .launch(Dispatchers .IO ) {
66+ listener.updateDefaultInterface(interfaceName, interfaceIndex)
67+ }
68+ } else {
69+ listener.updateDefaultInterface(interfaceName, interfaceIndex)
70+ }
5971 }
6072 } else {
61- listener.updateDefaultInterface(" " , - 1 )
73+ if (BuildConfig .DEBUG ) {
74+ GlobalScope .launch(Dispatchers .IO ) {
75+ listener.updateDefaultInterface(" " , - 1 )
76+ }
77+ } else {
78+ listener.updateDefaultInterface(" " , - 1 )
79+ }
6280 }
6381 }
6482
65-
6683}
0 commit comments