From c26377ae479d0b13657998af827de5e1cde72316 Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 23 Mar 2018 11:05:13 -0700 Subject: [PATCH] Fix pool registered after interruption --- .../java/be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt index 6f5f7427..1ef0ccab 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt @@ -71,12 +71,12 @@ class IpNeighbourMonitor private constructor() : Runnable { } } monitor.waitFor() + if (monitor.exitValue() == 0) return@thread + Log.w(TAG, "Failed to set up monitor, switching to polling") + val pool = Executors.newScheduledThreadPool(1) + pool.scheduleAtFixedRate(this, 1, 1, TimeUnit.SECONDS) + this.pool = pool } catch (ignore: InterruptedIOException) { } - if (monitor.exitValue() == 0) return@thread - Log.w(TAG, "Failed to set up monitor, switching to polling") - val pool = Executors.newScheduledThreadPool(1) - pool.scheduleAtFixedRate(this, 1, 1, TimeUnit.SECONDS) - this.pool = pool } }