Add onError callback to handle errors in protocol threads
This commit is contained in:
parent
5c3e253067
commit
5835a756ce
5 changed files with 28 additions and 27 deletions
|
|
@ -30,9 +30,11 @@ abstract class Protocol {
|
|||
|
||||
abstract val statistics: Statistics
|
||||
protected lateinit var state: MutableStateFlow<ProtocolState>
|
||||
protected lateinit var onError: (String) -> Unit
|
||||
|
||||
open fun initialize(context: Context, state: MutableStateFlow<ProtocolState>) {
|
||||
open fun initialize(context: Context, state: MutableStateFlow<ProtocolState>, onError: (String) -> Unit) {
|
||||
this.state = state
|
||||
this.onError = onError
|
||||
}
|
||||
|
||||
abstract fun startVpn(config: JSONObject, vpnBuilder: Builder, protect: (Int) -> Boolean)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue