Disconnect as soon as binder died
This commit is contained in:
@@ -48,7 +48,10 @@ class ShadowsocksConnection(private val instance: Interface) : ServiceConnection
|
||||
* Different from Android framework, this method will be called even when you call `detachService`.
|
||||
*/
|
||||
fun onServiceDisconnected() { }
|
||||
override fun binderDied() { }
|
||||
override fun binderDied() {
|
||||
connection.service = null
|
||||
connection.disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
private var connectionActive = false
|
||||
@@ -109,6 +112,7 @@ class ShadowsocksConnection(private val instance: Interface) : ServiceConnection
|
||||
connectionActive = false
|
||||
if (instance.listenForDeath) binder?.unlinkToDeath(instance, 0)
|
||||
binder = null
|
||||
service?.stopListeningForBandwidth(instance.serviceCallback)
|
||||
service = null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user