summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2024-06-26 16:42:33 +0200
committercyBerta <cyberta@riseup.net>2024-06-26 16:42:33 +0200
commit78540fb6815f2542d0155e0262d71439f96600ff (patch)
tree4c73fbe54a9012ac98d381d33d5d9ba3cb75a92c /app/src/main
parentc81753e4df82d35b7cd9527bd328d0c8d33712c0 (diff)
fix missing start() call for the obfsvpn client thread, implement EventLogger in the ObfsvpnClient instead of using an anonymous class implementing obfsvpn's EventLogger interface
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java
index dfdfbdd5..bf030a0f 100644
--- a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java
+++ b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java
@@ -13,7 +13,7 @@ import se.leap.bitmaskclient.pluggableTransports.models.KcpConfig;
import se.leap.bitmaskclient.pluggableTransports.models.Obfs4Options;
import se.leap.bitmaskclient.pluggableTransports.models.ObfsvpnConfig;
-public class ObfsvpnClient {
+public class ObfsvpnClient implements EventLogger {
public static final int PORT = 8080;
public static final String IP = "127.0.0.1";
@@ -40,31 +40,22 @@ public class ObfsvpnClient {
try {
Log.d(TAG, obfsvpnConfig.toString());
client = Client.newFFIClient(obfsvpnConfig.toString());
+ client.setEventLogger(this);
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
public int start() {
+
synchronized (LOCK) {
new Thread(() -> {
try {
- client.setEventLogger(new EventLogger() {
- @Override
- public void error(String s) {
- VpnStatus.logError("[obfs4-client] " + s);
- }
-
- @Override
- public void log(String state, String message) {
- VpnStatus.logDebug("[obfs4-client] " + state + ": " + message);
- }
- });
client.start();
} catch (Exception e) {
e.printStackTrace();
}
- });
+ }).start();
return PORT;
}
}
@@ -84,4 +75,15 @@ public class ObfsvpnClient {
public boolean isStarted() {
return client.isStarted();
}
+
+ @Override
+ public void error(String s) {
+ VpnStatus.logError("[obfs4-client] " + s);
+
+ }
+
+ @Override
+ public void log(String state, String message) {
+ VpnStatus.logDebug("[obfs4-client] " + state + ": " + message);
+ }
}