aboutsummaryrefslogtreecommitdiffstats
path: root/src/adapter.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2011-12-23 14:14:18 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2011-12-23 14:20:11 +0200
commit632164a86b5a13daceb19c602701beb1fbd5179e (patch)
treedde53e7a9102c2c25fa0e831d4d35ad2ae7d7bc2 /src/adapter.c
parentb06899eace1f484b387aae0e568fb1da988b468c (diff)
downloadbluez-632164a86b5a13daceb19c602701beb1fbd5179e.tar.gz
bluez-632164a86b5a13daceb19c602701beb1fbd5179e.tar.xz
bluez-632164a86b5a13daceb19c602701beb1fbd5179e.zip
Clean up name resolving state handling
Diffstat (limited to 'src/adapter.c')
-rw-r--r--src/adapter.c24
1 files changed, 8 insertions, 16 deletions
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;