mirror of
https://github.com/wgtunnel/android.git
synced 2026-07-03 14:07:49 +02:00
fix: tile control and kernel sync (#320)
increase auto tunnel delay to 3 seconds optimize stats job by killing it when app is backgrounded fix tunnel launch from background add restart of services and tunnels after update
This commit is contained in:
@@ -5,7 +5,7 @@ import kotlinx.coroutines.flow.Flow
|
||||
import java.io.File
|
||||
|
||||
interface LocalLogCollector {
|
||||
fun start(onLogMessage: ((message: LogMessage) -> Unit)? = null)
|
||||
suspend fun start(onLogMessage: ((message: LogMessage) -> Unit)? = null)
|
||||
|
||||
fun stop()
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ object LogcatUtil {
|
||||
internal object Logcat : LocalLogCollector {
|
||||
private var logcatReader: LogcatReader? = null
|
||||
|
||||
override fun start(onLogMessage: ((message: LogMessage) -> Unit)?) {
|
||||
override suspend fun start(onLogMessage: ((message: LogMessage) -> Unit)?) {
|
||||
logcatReader ?: run {
|
||||
logcatReader =
|
||||
LogcatReader(
|
||||
@@ -78,9 +78,7 @@ object LogcatUtil {
|
||||
onLogMessage,
|
||||
)
|
||||
}
|
||||
logcatReader?.let { logReader ->
|
||||
if (!logReader.isAlive) logReader.start()
|
||||
}
|
||||
logcatReader?.run()
|
||||
}
|
||||
|
||||
override fun stop() {
|
||||
@@ -142,7 +140,7 @@ object LogcatUtil {
|
||||
pID: String,
|
||||
private val logcatPath: String,
|
||||
private val callback: ((input: LogMessage) -> Unit)?,
|
||||
) : Thread() {
|
||||
) {
|
||||
private var logcatProc: Process? = null
|
||||
private var reader: BufferedReader? = null
|
||||
private var mRunning = true
|
||||
@@ -177,7 +175,7 @@ object LogcatUtil {
|
||||
}.let { last -> findIpv4AddressRegex.replace(last, "<ipv4-address>") }
|
||||
}
|
||||
|
||||
override fun run() {
|
||||
fun run() {
|
||||
if (outputStream == null) return
|
||||
try {
|
||||
clear()
|
||||
|
||||
Reference in New Issue
Block a user