summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/eip
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2021-02-15 21:38:33 +0000
committercyberta <cyberta@riseup.net>2021-02-15 21:38:33 +0000
commitefd90a35caf042d7955727e4a5d9a12927714ca8 (patch)
tree8a429d2cc592cc093802c237d633556233cb4a7b /app/src/main/java/se/leap/bitmaskclient/eip
parent50588d08d77529eb84686220cfe3c8816195d46b (diff)
parent4aad61b74f67a025e46fb1d5b4b96d916104912f (diff)
Merge branch 'faster_gateway_switch' into 'master'
switch faster to next gateway during eip setup if current one is not responsive Closes #9022 See merge request leap/bitmask_android!124
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java21
1 files changed, 3 insertions, 18 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
index 1c101e2d..f35e5e30 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
@@ -74,15 +74,12 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
private static final String TAG = EipSetupObserver.class.getName();
- //The real timout is 4*2s + 1*4s + 1*8s + 1*16s + 1*32s + 1*64s = 132 s;
- private static final String TIMEOUT = "4";
private static final int UPDATE_CHECK_TIMEOUT = 1000*60*60*24*7;
private Context context;
private VpnProfile setupVpnProfile;
private String observedProfileFromVpnStatus;
AtomicBoolean changingGateway = new AtomicBoolean(false);
AtomicInteger setupNClosestGateway = new AtomicInteger();
- AtomicInteger reconnectTry = new AtomicInteger();
private Vector<EipSetupListener> listeners = new Vector<>();
private SharedPreferences preferences;
private static EipSetupObserver instance;
@@ -109,10 +106,6 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
return instance.setupNClosestGateway.get() > 0;
}
- public static int connectionRetry() {
- return instance.reconnectTry.get();
- }
-
public static int gatewayOrder() {
return instance.setupNClosestGateway.get();
}
@@ -293,15 +286,9 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
if (ConnectionStatus.LEVEL_STOPPING == level) {
finishGatewaySetup(false);
} else if ("CONNECTRETRY".equals(state) && LEVEL_CONNECTING_NO_SERVER_REPLY_YET.equals(level)) {
- Log.d(TAG, "trying gateway: " + setupVpnProfile.getName());
- if (TIMEOUT.equals(logmessage)) {
- Log.e(TAG, "Timeout reached! Try next gateway!");
- VpnStatus.logError("Timeout reached! Try next gateway!");
- selectNextGateway();
- return;
- }
- int current = reconnectTry.get();
- reconnectTry.set(current + 1);
+ Log.e(TAG, "Timeout reached! Try next gateway!");
+ VpnStatus.logError("Timeout reached! Try next gateway!");
+ selectNextGateway();
} else if ("NOPROCESS".equals(state) && LEVEL_NOTCONNECTED == level) {
//??
} else if ("CONNECTED".equals(state)) {
@@ -327,7 +314,6 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
private void selectNextGateway() {
changingGateway.set(true);
- reconnectTry.set(0);
EipCommand.startVPN(context.getApplicationContext(), false, setupNClosestGateway.get() + 1);
}
@@ -337,7 +323,6 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
setupNClosestGateway.set(0);
observedProfileFromVpnStatus = null;
this.changingGateway.set(changingGateway);
- this.reconnectTry.set(0);
}
/**