Commit 9e62b380 authored by Mygod's avatar Mygod

Handle remote callback dying

parent 867c7603
...@@ -93,7 +93,12 @@ object BaseService { ...@@ -93,7 +93,12 @@ object BaseService {
} }
class Binder(private var data: Data? = null) : IShadowsocksService.Stub(), AutoCloseable { class Binder(private var data: Data? = null) : IShadowsocksService.Stub(), AutoCloseable {
val callbacks = RemoteCallbackList<IShadowsocksServiceCallback>() val callbacks = object : RemoteCallbackList<IShadowsocksServiceCallback>() {
override fun onCallbackDied(callback: IShadowsocksServiceCallback?, cookie: Any?) {
super.onCallbackDied(callback, cookie)
stopListeningForBandwidth(callback ?: return)
}
}
private val bandwidthListeners = mutableMapOf<IBinder, Long>() // the binder is the real identifier private val bandwidthListeners = mutableMapOf<IBinder, Long>() // the binder is the real identifier
private val handler = Handler() private val handler = Handler()
......
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