From 9c2906944fdc49dbbb7a6713fdcd5ef8906ce71f Mon Sep 17 00:00:00 2001 From: Mygod Date: Wed, 26 Dec 2018 01:32:38 +0800 Subject: [PATCH] Log a lot more about subroutings --- mobile/src/main/java/be/mygod/vpnhotspot/net/Subrouting.kt | 2 ++ .../java/be/mygod/vpnhotspot/net/monitor/UpstreamMonitor.kt | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/Subrouting.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/Subrouting.kt index 64ca85ca..45c11a05 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/Subrouting.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/Subrouting.kt @@ -62,6 +62,7 @@ class Subrouting(private val parent: Routing, priority: Int, val upstream: Strin init { Timber.d("Subrouting initialized from %s to %s", parent.downstream, upstream) + Timber.d(Thread.currentThread().stackTrace.joinToString("\n")) IpNeighbourMonitor.registerCallback(this) } @@ -71,6 +72,7 @@ class Subrouting(private val parent: Routing, priority: Int, val upstream: Strin override fun close() { IpNeighbourMonitor.unregisterCallback(this) Timber.d("Subrouting closed from %s to %s", parent.downstream, upstream) + Timber.d(Thread.currentThread().stackTrace.joinToString("\n")) } override fun onIpNeighbourAvailable(neighbours: List) = synchronized(parent) { diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/UpstreamMonitor.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/UpstreamMonitor.kt index 1994f93f..d716e247 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/UpstreamMonitor.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/UpstreamMonitor.kt @@ -77,8 +77,7 @@ abstract class UpstreamMonitor { fun registerCallback(callback: Callback) { synchronized(this) { - if (!callbacks.add(callback)) return - registerCallbackLocked(callback) + if (callbacks.add(callback)) registerCallbackLocked(callback) } } fun unregisterCallback(callback: Callback) = synchronized(this) {