diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-08-28 01:14:05 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-08-28 01:14:05 +0200 |
commit | e602d23e83f56028ca669b509e417238564192e8 (patch) | |
tree | 24412871cd640a95f010aaf4f45201ed3e412b10 /src/de/blinkt/openvpn/OpenVpnManagementThread.java | |
parent | 723d5d5eaafe7600e1959044ef25afa267540f93 (diff) |
- Add status message when waiting for network.
- Using a priority higher than PRIORITY_MIN stop the flickering of the notification but make the icon visible again :/
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnManagementThread.java')
-rw-r--r-- | src/de/blinkt/openvpn/OpenVpnManagementThread.java | 21 |
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]);
}
|