@@ -7171,6 +7171,8 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
struct btd_device *device,
uint8_t bdaddr_type)
{
+ bool remove_device = false;
+
DBG("");
if (!g_slist_find(adapter->connections, device)) {
@@ -7178,7 +7180,7 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
return;
}
- device_remove_connection(device, bdaddr_type);
+ device_remove_connection(device, bdaddr_type, &remove_device);
if (device_is_authenticating(device))
device_cancel_authentication(device, TRUE);
@@ -7188,6 +7190,13 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
return;
adapter->connections = g_slist_remove(adapter->connections, device);
+
+ if (remove_device) {
+ const char *path = device_get_path(device);
+
+ DBG("Removing temporary device %s", path);
+ btd_adapter_remove_device(adapter, device);
+ }
}
static void adapter_stop(struct btd_adapter *adapter)
@@ -3073,7 +3073,7 @@ static void set_temporary_timer(struct btd_device *dev, unsigned int timeout)
dev, NULL);
}
-void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
+void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type, bool *remove)
{
struct bearer_state *state = get_state(device, bdaddr_type);
DBusMessage *reply;
@@ -3159,7 +3159,7 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
DEVICE_INTERFACE, "Connected");
if (remove_device)
- set_temporary_timer(device, 0);
+ *remove = remove_device;
}
guint device_add_disconnect_watch(struct btd_device *device,
@@ -123,7 +123,7 @@ int device_notify_pincode(struct btd_device *device, gboolean secure,
void device_cancel_authentication(struct btd_device *device, gboolean aborted);
gboolean device_is_authenticating(struct btd_device *device);
void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type);
-void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type);
+void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type, bool *remove);
void device_request_disconnect(struct btd_device *device, DBusMessage *msg);
bool device_is_disconnecting(struct btd_device *device);
void device_set_ltk_enc_size(struct btd_device *device, uint8_t enc_size);