[gnome-keysign: 12/65] bluetoothreceive: add connection refused error handling



commit ef6e5c1a68f2a89bfc381637f70a05b82f5464d1
Author: RyuzakiKK <aasonykk gmail com>
Date:   Wed Aug 9 15:51:09 2017 +0200

    bluetoothreceive: add connection refused error handling

 keysign/bluetoothreceive.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/keysign/bluetoothreceive.py b/keysign/bluetoothreceive.py
index a47df2a..b215d0c 100644
--- a/keysign/bluetoothreceive.py
+++ b/keysign/bluetoothreceive.py
@@ -29,12 +29,14 @@ class BluetoothReceive:
                 part_message = yield threads.deferToThread(self.client_socket.recv, self.size)
                 message += part_message
         except BluetoothError as be:
-            if be.args[0] == "(113, 'No route to host')":
-                log.info("An error occurred with Bluetooth, if present probably the device is not powered")
+            if be.args[0] == "(16, 'Device or resource busy')":
+                log.info("Probably has been provided a partial bt mac")
+            elif be.args[0] == "(111, 'Connection refused')":
+                log.info("The sender refused our connection attempt")
             elif be.args[0] == "(112, 'Host is down')":
                 log.info("The sender's Bluetooth is not available")
-            elif be.args[0] == "(16, 'Device or resource busy')":
-                log.info("Probably has been provided a partial bt mac")
+            elif be.args[0] == "(113, 'No route to host')":
+                log.info("An error occurred with Bluetooth, if present probably the device is not powered")
             else:
                 log.info("An unknown bt error occurred: %s" % be.args[0])
             key_data = None


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]