From 6ff02fbc614756991220dacf910dc447a4046f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 7 Nov 2013 21:26:07 +0100 Subject: Special debug log: "OpenVPN log" tag The log shows all state commands, and notifies when bytecount values have not changed more than 3 times in a row. --- src/se/leap/openvpn/OpenVpnManagementThread.java | 9 ++++++--- src/se/leap/openvpn/VpnProfile.java | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/se/leap/openvpn/OpenVpnManagementThread.java b/src/se/leap/openvpn/OpenVpnManagementThread.java index 6ab86056..2445c38e 100644 --- a/src/se/leap/openvpn/OpenVpnManagementThread.java +++ b/src/se/leap/openvpn/OpenVpnManagementThread.java @@ -182,7 +182,6 @@ public class OpenVpnManagementThread implements Runnable { String cmd = parts[0].substring(1); String argument = parts[1]; - Log.d("OpenVPN log", command); if(cmd.equals("INFO")) { // Ignore greeting from mgmt //logStatusMessage(command); @@ -273,13 +272,14 @@ public class OpenVpnManagementThread implements Runnable { private void processState(String argument) { String[] args = argument.split(",",3); String currentstate = args[1]; + Log.d("OpenVPN log", argument); if(args[2].equals(",,")) OpenVPN.updateStateString(currentstate,""); else OpenVPN.updateStateString(currentstate,args[2]); } - + private static int repeated_byte_counts = 0; private void processByteCount(String argument) { // >BYTECOUNT:{BYTES_IN},{BYTES_OUT} int comma = argument.indexOf(','); @@ -288,7 +288,10 @@ public class OpenVpnManagementThread implements Runnable { long diffin = in - mLastIn; long diffout = out - mLastOut; - + if(diffin == 0 && diffout == 0) + repeated_byte_counts++; + if(repeated_byte_counts > 3) + Log.d("OpenVPN log", "Repeated byte count = " + repeated_byte_counts); mLastIn=in; mLastOut=out; diff --git a/src/se/leap/openvpn/VpnProfile.java b/src/se/leap/openvpn/VpnProfile.java index 8eebb763..41cf574b 100644 --- a/src/se/leap/openvpn/VpnProfile.java +++ b/src/se/leap/openvpn/VpnProfile.java @@ -108,7 +108,7 @@ public class VpnProfile implements Serializable{ public String mKeyPassword=""; public boolean mPersistTun = false; public String mConnectRetryMax="5"; - public String mConnectRetry="5"; + public String mConnectRetry="10"; public boolean mUserEditable=true; static final String MINIVPN = "miniopenvpn"; @@ -211,7 +211,7 @@ public class VpnProfile implements Serializable{ cfg+="connect-retry-max " + mConnectRetryMax+ "\n"; if(mConnectRetry==null) - mConnectRetry="5"; + mConnectRetry="10"; cfg+="connect-retry " + mConnectRetry + "\n"; -- cgit v1.2.3