summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnManagementThread.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnManagementThread.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnManagementThread.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
index d593832a..22da0241 100644
--- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java
+++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
@@ -37,7 +37,6 @@ public class OpenVpnManagementThread implements Runnable {
private int mBytecountinterval=2;
private long mLastIn=0;
private long mLastOut=0;
- private String mCurrentstate;
private LocalServerSocket mServerSocket;
private boolean mReleaseHold=true;
private boolean mWaitingForRelease=false;
@@ -185,10 +184,7 @@ public class OpenVpnManagementThread implements Runnable {
}else if (cmd.equals("PASSWORD")) {
processPWCommand(argument);
} else if (cmd.equals("HOLD")) {
- if(mReleaseHold)
- releaseHoldCmd();
- else
- mWaitingForRelease=true;
+ handleHold();
} else if (cmd.equals("NEED-OK")) {
processNeedCommand(argument);
} else if (cmd.equals("BYTECOUNT")){
@@ -216,6 +212,14 @@ public class OpenVpnManagementThread implements Runnable {
OpenVPN.logMessage(0, "MGMT:", "Got unrecognized line from management:" + command);
}
}
+ private void handleHold() {
+ if(mReleaseHold) {
+ releaseHoldCmd();
+ } else {
+ mWaitingForRelease=true;
+ OpenVPN.updateStateString("NONETWORK", "Waiting for usable network");
+ }
+ }
private void releaseHoldCmd() {
mWaitingForRelease=false;
managmentCommand("hold release\n");
@@ -256,8 +260,11 @@ public class OpenVpnManagementThread implements Runnable {
}
private void processState(String argument) {
String[] args = argument.split(",",3);
- mCurrentstate = args[1];
- OpenVPN.updateStateString(mCurrentstate,args[2]);
+ String currentstate = args[1];
+ if(args[2].equals(",,"))
+ OpenVPN.updateStateString(currentstate,"");
+ else
+ OpenVPN.updateStateString(currentstate,args[2]);
}