Properly close connection.
This commit is contained in:
parent
bd9ea26bd5
commit
db33264b2d
1 changed files with 3 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue