From 68b6f8915630c8d68d3371092dced487447aea6b Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 1 Jan 2014 17:48:13 +0100 Subject: Ignore certain status changes --- build.gradle | 2 +- src/de/blinkt/openvpn/core/OpenVpnManagementThread.java | 1 + src/de/blinkt/openvpn/core/VpnStatus.java | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index b227af89..44012cb0 100644 --- a/build.gradle +++ b/build.gradle @@ -62,7 +62,7 @@ android { } lintOptions { - disable 'MissingTranslation', 'Typos' + disable 'MissingTranslation' enable 'IconExpectedSize' } diff --git a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java index caec4bd7..cfc6776d 100644 --- a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java +++ b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java @@ -339,6 +339,7 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement { private void processState(String argument) { String[] args = argument.split(",",3); String currentstate = args[1]; + if(args[2].equals(",,")) VpnStatus.updateStateString(currentstate, ""); else diff --git a/src/de/blinkt/openvpn/core/VpnStatus.java b/src/de/blinkt/openvpn/core/VpnStatus.java index 20b56172..1a3a7a26 100644 --- a/src/de/blinkt/openvpn/core/VpnStatus.java +++ b/src/de/blinkt/openvpn/core/VpnStatus.java @@ -444,15 +444,26 @@ public class VpnStatus { } public synchronized static void updateStateString(String state, String msg, int resid, ConnectionStatus level) { - mLaststate= state; + // Workound for OpenVPN doing AUTH and wait and being connected + // Simply ignore these state + if (mLastLevel == ConnectionStatus.LEVEL_CONNECTED && + (state.equals("WAIT") || state.equals("AUTH"))) + { + newLogItem(new LogItem((LogLevel.DEBUG), String.format("Ignoring OpenVPN Status in CONNECTED state (%s->%s): %s",state,level.toString(),msg))); + return; + } + + mLaststate= state; mLaststatemsg = msg; mLastStateresid = resid; mLastLevel = level; - for (StateListener sl : stateListener) { + + + for (StateListener sl : stateListener) { sl.updateState(state,msg,resid,level); } - newLogItem(new LogItem((LogLevel.DEBUG), String.format("New OpenVPN Status (%s->%s): %s",state,level.toString(),msg))); + //newLogItem(new LogItem((LogLevel.DEBUG), String.format("New OpenVPN Status (%s->%s): %s",state,level.toString(),msg))); } public static void logInfo(String message) { -- cgit v1.2.3