summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-adapter.c9
-rw-r--r--hcid/dbus.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index ae36453e..001aa2f3 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -1811,7 +1811,10 @@ static gboolean create_bonding_conn_complete(GIOChannel *io, GIOCondition cond,
if (cond & (G_IO_HUP | G_IO_ERR)) {
debug("Hangup or error on bonding IO channel");
- error_failed(pdata->bonding->conn, pdata->bonding->rq, EIO);
+ if (!pdata->bonding->connected)
+ error_connection_attempt_failed(pdata->bonding->conn, pdata->bonding->rq, ENETDOWN);
+ else
+ error_failed(pdata->bonding->conn, pdata->bonding->rq, EIO);
goto failed;
}
@@ -1829,6 +1832,8 @@ static gboolean create_bonding_conn_complete(GIOChannel *io, GIOCondition cond,
goto failed;
}
+ pdata->bonding->connected = 1;
+
len = sizeof(cinfo);
if (getsockopt(sk, SOL_L2CAP, L2CAP_CONNINFO, &cinfo, &len) < 0) {
error("Can't get connection info: %s (%d)", strerror(errno), errno);
@@ -1954,7 +1959,7 @@ static DBusHandlerResult handle_dev_create_bonding_req(DBusConnection *conn, DBu
dbus_data->bonding->io = g_io_channel_unix_new(sk);
dbus_data->bonding->io_id = g_io_add_watch(dbus_data->bonding->io,
- G_IO_OUT | G_IO_NVAL,
+ G_IO_OUT | G_IO_NVAL | G_IO_HUP | G_IO_ERR,
(GIOFunc) create_bonding_conn_complete,
dbus_data);
diff --git a/hcid/dbus.h b/hcid/dbus.h
index 64f6a002..6c7dc015 100644
--- a/hcid/dbus.h
+++ b/hcid/dbus.h
@@ -89,6 +89,7 @@ struct bonding_request_info {
GIOChannel *io;
guint io_id;
int cancel;
+ int connected;
};
struct pending_pin_info {