summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-10-25 10:57:49 +0200
committercyBerta <cyberta@riseup.net>2019-10-25 10:57:49 +0200
commit6b4f3597733ced8d312ed263d53b9669d6274d65 (patch)
tree045198efae0435910054a065b1304e7ddcf981c7
parent02ffacb6b56fb02b0d58157123edf7b91380e3f8 (diff)
handle errors during the initiation of a pt connection separately
only run-time errors, reported by connections will be handled in shapeshifterErrorListner (https://0xacab.org/leap/shapeshifter/issues/1)
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java39
1 files changed, 18 insertions, 21 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java
index 6d3b1db2..3fefb6e7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java
+++ b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java
@@ -33,8 +33,8 @@ public class Shapeshifter {
public static final String DISPATCHER_IP = "127.0.0.1";
private static final String TAG = Shapeshifter.class.getSimpleName();
- ShapeShifter shapeShifter;
- ShapeshifterErrorListner shapeshifterErrorListner;
+ private ShapeShifter shapeShifter;
+ private ShapeshifterErrorListner shapeshifterErrorListner;
public interface ShapeshifterErrorListenerCallback {
void onStarted();
@@ -53,25 +53,22 @@ public class Shapeshifter {
}
public void start() {
- try {
- ShapeshifterErrorListenerCallback errorListenerCallback = () -> {
- ;
- Handler handler = new Handler(Looper.getMainLooper());
- handler.postDelayed(() -> {
- try {
- Log.d(TAG, "shapeshifter open");
- shapeShifter.open();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }, 200);
- };
- shapeshifterErrorListner = new ShapeshifterErrorListner(errorListenerCallback);
- shapeshifterErrorListner.execute(shapeShifter);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
+ ShapeshifterErrorListenerCallback errorListenerCallback = () -> {
+ ;
+ Handler handler = new Handler(Looper.getMainLooper());
+ handler.postDelayed(() -> {
+ try {
+ Log.d(TAG, "shapeshifter open");
+ shapeShifter.open();
+ } catch (Exception e) {
+ Log.e(TAG, "SHAPESHIFTER ERROR: " + e.getLocalizedMessage());
+ VpnStatus.logError(VpnStatus.ErrorType.SHAPESHIFTER);
+ VpnStatus.logError(e.getLocalizedMessage());
+ }
+ }, 200);
+ };
+ shapeshifterErrorListner = new ShapeshifterErrorListner(errorListenerCallback);
+ shapeshifterErrorListner.execute(shapeShifter);
}
public boolean stop() {