summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-08-02 00:46:39 +0200
committercyBerta <cyberta@riseup.net>2019-08-02 01:49:37 +0200
commitec891871adb9ad75918fcdf33c45a33cafba044a (patch)
treea0732b78da16f865626b5f9d397ccd67d666bb27 /app
parent5144166172e3620a5bd9f6df7436222afeb4d133 (diff)
cleanup in OpenVPNService
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java24
1 files changed, 5 insertions, 19 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index 6f817323..e446021f 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -43,10 +43,9 @@ import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.VpnStatus.ByteCountListener;
import de.blinkt.openvpn.core.VpnStatus.StateListener;
import de.blinkt.openvpn.core.connection.Connection;
+import de.blinkt.openvpn.core.connection.Obfs4Connection;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.VpnNotificationManager;
-import se.leap.bitmaskclient.pluggableTransports.Dispatcher;
-import de.blinkt.openvpn.core.connection.Obfs4Connection;
import se.leap.bitmaskclient.pluggableTransports.Shapeshifter;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTED;
@@ -250,9 +249,6 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
if (shapeshifter != null) {
shapeshifter.stop();
}
- /*if (dispatcher != null && dispatcher.isRunning()) {
- dispatcher.stop();
- }*/
VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED);
}
return true;
@@ -263,9 +259,6 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
if (shapeshifter != null) {
shapeshifter.stop();
}
- /*if (dispatcher != null && dispatcher.isRunning()) {
- dispatcher.stop();
- }*/
VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED);
return true;
}
@@ -389,28 +382,21 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
// the dispatcher here? Can we start the dispatcher at a later point of execution, e.g. when
// connections[n], n>0 gets choosen?
- VpnStatus.logInfo("Setting up dispatcher.");
Connection connection = mProfile.mConnections[0];
if (mProfile.mUsePluggableTransports) {
Obfs4Connection obfs4Connection = (Obfs4Connection) connection;
- //dispatcher = new Dispatcher(this, obfs4Connection.getDispatcherOptions());
- //dispatcher.initSync();
shapeshifter = new Shapeshifter(obfs4Connection.getDispatcherOptions());
- if (shapeshifter.start()) {
- // FIXME: we already know the shapeshifter port earlier!
- connection.setServerPort(Shapeshifter.DISPATCHER_PORT);
- } else {
- Log.e(TAG, "Cannot initialize dispatcher for obfs4 connection. Shutting down.");
- VpnStatus.logError("Cannot initialize dispatcher for obfs4 connection. Shutting down.");
+ if (!shapeshifter.start()) {
+ //TODO: implement useful error handling
+ Log.e(TAG, "Cannot initialize shapeshifter dispatcher for obfs4 connection. Shutting down.");
+ VpnStatus.logError("Cannot initialize shapeshifter dispatcher for obfs4 connection. Shutting down.");
}
}
-
VpnStatus.logInfo(R.string.building_configration);
VpnStatus.updateStateString("VPN_GENERATE_CONFIG", "", R.string.building_configration, ConnectionStatus.LEVEL_START);
-
try {
mProfile.writeConfigFile(this);
} catch (IOException e) {