Fix default mode set incorrectly
This commit is contained in:
@@ -21,7 +21,7 @@ abstract class IpMonitor : Runnable {
|
|||||||
Monitor, MonitorRoot, Poll
|
Monitor, MonitorRoot, Poll
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MonitorFailure : RuntimeException()
|
private class MonitorFailure : RuntimeException("Failed to set up monitor, switching to polling")
|
||||||
private class FlushFailure : RuntimeException()
|
private class FlushFailure : RuntimeException()
|
||||||
protected abstract val monitoredObject: String
|
protected abstract val monitoredObject: String
|
||||||
protected abstract fun processLine(line: String)
|
protected abstract fun processLine(line: String)
|
||||||
@@ -59,7 +59,7 @@ abstract class IpMonitor : Runnable {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
thread("${javaClass.simpleName}-input") {
|
thread("${javaClass.simpleName}-input") {
|
||||||
val mode = Mode.valueOf(app.pref.getString(KEY, Mode.Monitor.toString()) ?: "")
|
val mode = Mode.valueOf(app.pref.getString(KEY, Mode.Poll.toString()) ?: "")
|
||||||
if (mode != Mode.Poll) {
|
if (mode != Mode.Poll) {
|
||||||
if (mode != Mode.MonitorRoot) {
|
if (mode != Mode.MonitorRoot) {
|
||||||
// monitor may get rejected by SELinux enforcing
|
// monitor may get rejected by SELinux enforcing
|
||||||
@@ -68,7 +68,6 @@ abstract class IpMonitor : Runnable {
|
|||||||
}
|
}
|
||||||
handleProcess(ProcessBuilder("su", "-c", "exec ip monitor $monitoredObject"))
|
handleProcess(ProcessBuilder("su", "-c", "exec ip monitor $monitoredObject"))
|
||||||
if (destroyed) return@thread
|
if (destroyed) return@thread
|
||||||
Timber.w("Failed to set up monitor, switching to polling")
|
|
||||||
Timber.i(MonitorFailure())
|
Timber.i(MonitorFailure())
|
||||||
}
|
}
|
||||||
val pool = Executors.newScheduledThreadPool(1)
|
val pool = Executors.newScheduledThreadPool(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user