From 2b0acd649b916d753a52474d5456f6550cfd4922 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Fri, 21 Aug 2015 13:18:53 +0200 Subject: [PATCH] Pebble: close TCP socket when disconnecting from emulator. Prevents hang. --- .../service/devices/pebble/PebbleIoThread.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java index 79b56c1e..28199529 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java @@ -502,6 +502,13 @@ public class PebbleIoThread extends GBDeviceIoThread { e.printStackTrace(); } } + if (mTCPSocket != null) { + try { + mTCPSocket.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } private enum PebbleAppInstallState {