diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2006-09-27 12:22:15 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2006-09-27 12:22:15 +0000 |
commit | b04999d679c3e7bd11d036c3b9fd908f74cf1a71 (patch) | |
tree | 7c3269c3d88ac9af7809febf1e0cf7d42d9fae96 | |
parent | 31043efa1d0516eadb9c1e536be1ed7b897fb287 (diff) |
Reply with correct error to CreateBonding when a page timeout occurs
-rw-r--r-- | hcid/dbus-adapter.c | 9 | ||||
-rw-r--r-- | hcid/dbus.h | 1 |
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 { |