void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
{
struct bearer_state *state = get_state(device, bdaddr_type);
+ DBusMessage *reply;
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
char *dev_name = device->name;
#endif
}
#endif
+ /* This could be executed while the client is waiting for Connect() but
+ * att_connect_cb has not been invoked.
+ * In that case reply the client that the connection failed.
+ */
+ if (device->connect) {
+ DBG("connection removed while Connect() is waiting reply");
+ reply = btd_error_failed(device->connect, "Disconnected early");
+ g_dbus_send_message(dbus_conn, reply);
+ dbus_message_unref(device->connect);
+ device->connect = NULL;
+ }
+
while (device->disconnects) {
DBusMessage *msg = device->disconnects->data;