summaryrefslogtreecommitdiff
path: root/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc')
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
index 16960aa1d4..b4370e4b12 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
@@ -106,14 +106,12 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) {
if (0 == connect_status) {
LOG4CXX_DEBUG(logger_, "rfcomm Connect ok");
break;
- }
- if (errno != 111 && errno != 104) {
- LOG4CXX_DEBUG(logger_, "rfcomm Connect errno " << errno);
- break;
- }
- if (errno) {
- LOG4CXX_DEBUG(logger_, "rfcomm Connect errno " << errno);
- close(rfcomm_socket);
+ } else { // If connect_status is not 0, an errno is returned
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "rfcomm Connect failed");
+ close(rfcomm_socket); // Always close the socket upon error
+ if (errno != ECONNREFUSED && errno != ECONNRESET) {
+ break;
+ }
}
sleep(2);
} while (--attempts > 0);