summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-10-24 18:19:21 +0200
committercyBerta <cyberta@riseup.net>2019-10-24 18:21:24 +0200
commit02ffacb6b56fb02b0d58157123edf7b91380e3f8 (patch)
treef8d3b7d97ab487d6a851f8982f8ed3dadac5b78e
parent06c88a9fb258eedf816d4a5e030264209a3df557 (diff)
don't let the main thread sleep for 3 seconds on every vpn gateway setup
fixes main reason for #8963
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
index 91cc66bc..787d2b1b 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
@@ -12,6 +12,7 @@ import android.net.LocalSocket;
import android.net.LocalSocketAddress;
import android.os.Build;
import android.os.Handler;
+import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
@@ -21,6 +22,7 @@ import android.util.Log;
import de.blinkt.openvpn.core.connection.Connection;
import se.leap.bitmaskclient.R;
import de.blinkt.openvpn.VpnProfile;
+import se.leap.bitmaskclient.utils.ConfigHelper;
import java.io.FileDescriptor;
import java.io.IOException;
@@ -30,6 +32,7 @@ import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.*;
+import java.util.logging.Logger;
public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
@@ -43,7 +46,6 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
private LinkedList<FileDescriptor> mFDList = new LinkedList<>();
private LocalServerSocket mServerSocket;
private boolean mWaitingForRelease = false;
- private long mLastHoldRelease = 0;
private LocalSocket mServerSocketLocal;
private pauseReason lastPauseReason = pauseReason.noNetwork;
@@ -421,15 +423,7 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
private void releaseHoldCmd() {
mResumeHandler.removeCallbacks(mResumeHoldRunnable);
- if ((System.currentTimeMillis() - mLastHoldRelease) < 5000) {
- try {
- Thread.sleep(3000);
- } catch (InterruptedException ignored) {
- }
-
- }
mWaitingForRelease = false;
- mLastHoldRelease = System.currentTimeMillis();
managmentCommand("hold release\n");
managmentCommand("bytecount " + mBytecountInterval + "\n");
managmentCommand("state on\n");