aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/hciops.c6
-rw-r--r--src/adapter.c24
-rw-r--r--src/adapter.h2
-rw-r--r--src/event.c4
4 files changed, 9 insertions, 27 deletions
diff --git a/plugins/hciops.c b/plugins/hciops.c
index f3115a17..7d807c8b 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -191,11 +191,7 @@ static void set_state(int index, int state)
if (adapter_get_state(adapter) == STATE_SUSPENDED)
return;
- if (is_resolvname_enabled() &&
- adapter_has_discov_sessions(adapter))
- adapter_set_state(adapter, STATE_RESOLVNAME);
- else
- adapter_set_state(adapter, STATE_IDLE);
+ adapter_set_state(adapter, STATE_IDLE);
break;
case DISCOV_INQ:
case DISCOV_SCAN:
diff --git a/src/adapter.c b/src/adapter.c
index 8b2a6d88..2d9e368c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -214,7 +214,7 @@ static int pending_remote_name_cancel(struct btd_adapter *adapter)
return err;
}
-int adapter_resolve_names(struct btd_adapter *adapter)
+static int adapter_resolve_names(struct btd_adapter *adapter)
{
struct remote_dev_info *dev, match;
int err;
@@ -2591,18 +2591,6 @@ static inline void suspend_discovery(struct btd_adapter *adapter)
adapter_ops->stop_discovery(adapter->dev_id);
}
-static inline void resolve_names(struct btd_adapter *adapter)
-{
- int err;
-
- if (adapter->state != STATE_RESOLVNAME)
- return;
-
- err = adapter_resolve_names(adapter);
- if (err < 0)
- adapter_set_state(adapter, STATE_IDLE);
-}
-
void adapter_set_state(struct btd_adapter *adapter, int state)
{
const char *path = adapter->path;
@@ -2617,6 +2605,13 @@ void adapter_set_state(struct btd_adapter *adapter, int state)
switch (adapter->state) {
case STATE_IDLE:
+ if (main_opts.name_resolv &&
+ adapter_has_discov_sessions(adapter) &&
+ adapter_resolve_names(adapter) == 0) {
+ adapter->state = STATE_RESOLVNAME;
+ return;
+ }
+
update_oor_devices(adapter);
discov_active = FALSE;
@@ -2636,9 +2631,6 @@ void adapter_set_state(struct btd_adapter *adapter, int state)
ADAPTER_INTERFACE, "Discovering",
DBUS_TYPE_BOOLEAN, &discov_active);
break;
- case STATE_RESOLVNAME:
- resolve_names(adapter);
- break;
case STATE_SUSPENDED:
suspend_discovery(adapter);
break;
diff --git a/src/adapter.h b/src/adapter.h
index 50e27d43..3e93441f 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -101,8 +101,6 @@ void adapter_remove_device(DBusConnection *conn, struct btd_adapter *adapter,
struct btd_device *device,
gboolean remove_storage);
-int adapter_resolve_names(struct btd_adapter *adapter);
-
struct btd_adapter *adapter_create(DBusConnection *conn, int id);
gboolean adapter_init(struct btd_adapter *adapter);
void adapter_remove(struct btd_adapter *adapter);
diff --git a/src/event.c b/src/event.c
index cc0e85f2..4e61666e 100644
--- a/src/event.c
+++ b/src/event.c
@@ -381,10 +381,6 @@ proceed:
/* remove from remote name request list */
adapter_remove_found_device(adapter, peer);
- /* check if there is more devices to request names */
- if (adapter_resolve_names(adapter) == 0)
- return;
-
adapter_set_state(adapter, STATE_IDLE);
}