Commit 8e145cd0 authored by Daniel Wolf's avatar Daniel Wolf

Set the packet store to null after it has been cleared (or when the thread hasn't been started yet)

parent f476e2d2
......@@ -242,7 +242,6 @@ open class VPNTunnelProxy(val packetProxy: PacketProxy,
cleanup()
tunnelHandle?.clear(true)
tunnelHandle = null
forwardedPacketStore = null
deviceInput?.closeSilently()
deviceOutput?.closeSilently()
}
......@@ -250,7 +249,17 @@ open class VPNTunnelProxy(val packetProxy: PacketProxy,
private fun cleanup() {
logger?.info { "cleanup() called" }
proxyThread?.interrupt()
proxyThread?.interrupt() ?: run {
if (Looper.getMainLooper().thread == Thread.currentThread()) {
GlobalScope.launch {
forwardedPacketStore?.clear()
forwardedPacketStore = null
}
} else {
forwardedPacketStore?.clear()
forwardedPacketStore = null
}
}
nonPollableProxyThread?.interrupt()
exceptionCallbacks.clear()
}
......@@ -268,6 +277,7 @@ open class VPNTunnelProxy(val packetProxy: PacketProxy,
}
} else forwardedPacketStore?.clear()
tunnelHandle?.clear(false)
forwardedPacketStore = null
}
@Throws(ErrnoException::class)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment