From db33264b2d160716d46102f41590bfb9595563cf Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Sat, 13 Dec 2014 04:02:12 +0200 Subject: [PATCH] Properly close connection. --- .../scala/com/nutomic/ensichat/bluetooth/TransferThread.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/scala/com/nutomic/ensichat/bluetooth/TransferThread.scala b/app/src/main/scala/com/nutomic/ensichat/bluetooth/TransferThread.scala index b817a5a..6ad37f3 100644 --- a/app/src/main/scala/com/nutomic/ensichat/bluetooth/TransferThread.scala +++ b/app/src/main/scala/com/nutomic/ensichat/bluetooth/TransferThread.scala @@ -58,6 +58,7 @@ class TransferThread(device: Device, socket: BluetoothSocket, service: ChatServi Log.i(Tag, "Received invalid message", e) case e: IOException => Log.w(Tag, "Failed to read incoming message", e) + close() return } } @@ -79,6 +80,8 @@ class TransferThread(device: Device, socket: BluetoothSocket, service: ChatServi socket.close() } catch { case e: IOException => Log.e(Tag, "Failed to close socket", e); + } finally { + service.onConnectionChanged(new Device(device.bluetoothDevice, false), null) } }