@ -3,7 +3,6 @@
package com.tailscale.ipn.ui.notifier
package com.tailscale.ipn.ui.notifier
import android.util.Log
import com.tailscale.ipn.App
import com.tailscale.ipn.App
import com.tailscale.ipn.ui.model.Empty
import com.tailscale.ipn.ui.model.Empty
import com.tailscale.ipn.ui.model.Health
import com.tailscale.ipn.ui.model.Health
@ -11,6 +10,7 @@ import com.tailscale.ipn.ui.model.Ipn
import com.tailscale.ipn.ui.model.Ipn.Notify
import com.tailscale.ipn.ui.model.Ipn.Notify
import com.tailscale.ipn.ui.model.Netmap
import com.tailscale.ipn.ui.model.Netmap
import com.tailscale.ipn.ui.util.set
import com.tailscale.ipn.ui.util.set
import com.tailscale.ipn.util.TSLog
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.MutableStateFlow
@ -19,7 +19,6 @@ import kotlinx.coroutines.launch
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.decodeFromStream
import kotlinx.serialization.json.decodeFromStream
import com.tailscale.ipn.util.TSLog
// Notifier is a wrapper around the IPN Bus notifier. It provides a way to watch
// Notifier is a wrapper around the IPN Bus notifier. It provides a way to watch
// for changes in various parts of the Tailscale engine. You will typically only use
// for changes in various parts of the Tailscale engine. You will typically only use
@ -69,7 +68,8 @@ object Notifier {
NotifyWatchOpt . Netmap . value or
NotifyWatchOpt . Netmap . value or
NotifyWatchOpt . Prefs . value or
NotifyWatchOpt . Prefs . value or
NotifyWatchOpt . InitialState . value or
NotifyWatchOpt . InitialState . value or
NotifyWatchOpt . InitialHealthState . value
NotifyWatchOpt . InitialHealthState . value or
NotifyWatchOpt . RateLimitNetmaps . value
manager =
manager =
app . watchNotifications ( mask . toLong ( ) ) { notification ->
app . watchNotifications ( mask . toLong ( ) ) { notification ->
val notify = decoder . decodeFromStream < Notify > ( notification . inputStream ( ) )
val notify = decoder . decodeFromStream < Notify > ( notification . inputStream ( ) )
@ -108,9 +108,10 @@ object Notifier {
InitialTailFSShares ( 32 ) ,
InitialTailFSShares ( 32 ) ,
InitialOutgoingFiles ( 64 ) ,
InitialOutgoingFiles ( 64 ) ,
InitialHealthState ( 128 ) ,
InitialHealthState ( 128 ) ,
RateLimitNetmaps ( 256 ) ,
}
}
fun setState ( newState : Ipn . State ) {
fun setState ( newState : Ipn . State ) {
_state . value = newState
_state . value = newState
}
}
}
}