summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hcid/adapter.c14
-rw-r--r--hcid/adapter.h2
-rw-r--r--hcid/dbus-hci.c5
3 files changed, 21 insertions, 0 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index cd75e6c9..47dbed1d 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -2442,6 +2442,19 @@ struct device *adapter_get_device(DBusConnection *conn,
return adapter_create_device(conn, adapter, address);
}
+void remove_pending_device(struct adapter *adapter)
+{
+ struct device *device;
+ char address[18];
+
+ ba2str(&adapter->bonding->bdaddr, address);
+ device = adapter_find_device(adapter, address);
+ if (!device)
+ return;
+
+ adapter_remove_device(adapter->bonding->conn, adapter, device);
+}
+
static gboolean create_bonding_conn_complete(GIOChannel *io, GIOCondition cond,
struct adapter *adapter)
{
@@ -2561,6 +2574,7 @@ static gboolean create_bonding_conn_complete(GIOChannel *io, GIOCondition cond,
failed:
g_io_channel_close(io);
+ remove_pending_device(adapter);
cleanup:
name_listener_remove(adapter->bonding->conn,
diff --git a/hcid/adapter.h b/hcid/adapter.h
index d715d58f..421684f8 100644
--- a/hcid/adapter.h
+++ b/hcid/adapter.h
@@ -136,3 +136,5 @@ GSList *service_classes_str(uint32_t class);
int pending_remote_name_cancel(struct adapter *adapter);
void dc_pending_timeout_cleanup(struct adapter *adapter);
+
+void remove_pending_device(struct adapter *adapter);
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index 36c9a9bd..f7233285 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -333,6 +333,9 @@ static void reply_pending_requests(const char *path, struct adapter *adapter)
/* pending bonding */
if (adapter->bonding) {
error_authentication_canceled(connection, adapter->bonding->msg);
+
+ remove_pending_device(adapter);
+
name_listener_remove(connection,
dbus_message_get_sender(adapter->bonding->msg),
(name_cb_t) create_bond_req_exit,
@@ -2435,6 +2438,8 @@ void create_bond_req_exit(const char *name, struct adapter *adapter)
g_free(p);
}
+ remove_pending_device(adapter);
+
g_io_channel_close(adapter->bonding->io);
if (adapter->bonding->io_id)
g_source_remove(adapter->bonding->io_id);