From 6b4f3597733ced8d312ed263d53b9669d6274d65 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 25 Oct 2019 10:57:49 +0200 Subject: 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) --- .../pluggableTransports/Shapeshifter.java | 39 ++++++++++------------ 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'app') 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() { -- cgit v1.2.3