openvpn connection status fix
This commit is contained in:
parent
28ae7eeaee
commit
6a9cc9bf37
1 changed files with 78 additions and 80 deletions
|
|
@ -28,25 +28,18 @@ import net.openvpn.ovpn3.ClientAPI_TransportStats
|
||||||
|
|
||||||
class OpenVPNThreadv3(var service: VPNService): ClientAPI_OpenVPNClient(), Runnable {
|
class OpenVPNThreadv3(var service: VPNService): ClientAPI_OpenVPNClient(), Runnable {
|
||||||
private val tag = "OpenVPNThreadv3"
|
private val tag = "OpenVPNThreadv3"
|
||||||
private var mConfig: JSONObject? = null
|
|
||||||
private var mAlreadyInitialised = false
|
private var mAlreadyInitialised = false
|
||||||
private var mService: VPNService = service
|
private var mService: VPNService = service
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
//TEMP
|
|
||||||
|
|
||||||
val config: ClientAPI_Config = ClientAPI_Config()
|
val config: ClientAPI_Config = ClientAPI_Config()
|
||||||
config.content = mService.getVpnConfig().getString("openvpn_config_data")
|
config.content = mService.getVpnConfig().getString("openvpn_config_data")
|
||||||
|
|
||||||
eval_config(config)
|
eval_config(config)
|
||||||
val status = connect()
|
val status = connect()
|
||||||
Log.i(tag, "ERROR " + status)
|
if (status.getError()) {
|
||||||
if (status.getError() != false) {
|
|
||||||
Log.i(tag, "connect() error: " + status.getError() + ": " + status.getMessage())
|
Log.i(tag, "connect() error: " + status.getError() + ": " + status.getMessage())
|
||||||
mService.openvpnConnected()
|
|
||||||
} else {
|
|
||||||
Log.i(tag, "Connect succesfully, OpenVPN3 thread finished")
|
|
||||||
mService.openvpnConnected()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +48,12 @@ class OpenVPNThreadv3(var service: VPNService): ClientAPI_OpenVPNClient(), Runna
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun event(event: ClientAPI_Event ) {
|
override fun event(event: ClientAPI_Event ) {
|
||||||
Log.i(tag, event.getName())
|
val eventName = event.getName()
|
||||||
|
when (eventName) {
|
||||||
|
"CONNECTED" -> mService.isUp = true
|
||||||
|
"DISCONNECTED" -> mService.isUp = false
|
||||||
|
}
|
||||||
|
Log.i(tag, eventName)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun tun_builder_new(): Boolean {
|
override fun tun_builder_new(): Boolean {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue