diff options
author | Sean Leonard <meanderingcode@aetherislands.net> | 2013-11-13 16:34:14 -0800 |
---|---|---|
committer | Sean Leonard <meanderingcode@aetherislands.net> | 2013-11-13 16:34:14 -0800 |
commit | 5e2588f199edef2c54d6357c53e4bcbcb148d5a9 (patch) | |
tree | e810f9223bea26e9a3be2964c11340f6871275a3 /src/se/leap | |
parent | 81c880130a3eac273d6d8dfdc054a3fd1eb5a24e (diff) | |
parent | 5b772c23c3f45405f30de4a180fe47dbcb2fdfc4 (diff) |
Merge branch 'bug/vpn-reconnect-sometimes-hangs' into develop
Diffstat (limited to 'src/se/leap')
-rw-r--r-- | src/se/leap/openvpn/OpenVPN.java | 4 | ||||
-rw-r--r-- | src/se/leap/openvpn/OpenVpnManagementThread.java | 12 | ||||
-rw-r--r-- | src/se/leap/openvpn/VpnProfile.java | 4 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/se/leap/openvpn/OpenVPN.java b/src/se/leap/openvpn/OpenVPN.java index c6055abd..d7d17b4f 100644 --- a/src/se/leap/openvpn/OpenVPN.java +++ b/src/se/leap/openvpn/OpenVPN.java @@ -9,6 +9,7 @@ import se.leap.bitmaskclient.R; import android.content.Context; import android.os.Build; +import android.util.Log; public class OpenVPN { @@ -57,6 +58,7 @@ public class OpenVPN { public LogItem(String message) { + mMessage = message; } @@ -113,7 +115,7 @@ public class OpenVPN { synchronized static void logMessage(int level,String prefix, String message) { newlogItem(new LogItem(prefix + message)); - + Log.d("OpenVPN log item", message); } synchronized static void clearLog() { diff --git a/src/se/leap/openvpn/OpenVpnManagementThread.java b/src/se/leap/openvpn/OpenVpnManagementThread.java index 028c6ec7..78ce5a2b 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];
-
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;
@@ -330,7 +333,8 @@ public class OpenVpnManagementThread implements Runnable { mOpenVPNService.setDomain(extra);
} else if (needed.equals("ROUTE")) {
String[] routeparts = extra.split(" ");
- mOpenVPNService.addRoute(routeparts[0], routeparts[1]);
+ if(!mOpenVPNService.isRunning()) // We cannot add routes to an existing openvpn session
+ mOpenVPNService.addRoute(routeparts[0], routeparts[1]);
} else if (needed.equals("ROUTE6")) {
mOpenVPNService.addRoutev6(extra);
} else if (needed.equals("IFCONFIG")) {
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"; |