summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-adapter.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-04-20 18:42:17 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-04-20 18:42:17 +0000
commitf6e734a152c82885d39a2a3563dd581a6d41deb2 (patch)
tree598639a46357bc7df78373f185c15f56c0aa2906 /hcid/dbus-adapter.c
parent36d0506a28a2413467d2c5e793d53c45b2183d34 (diff)
GetRemoteName must return the cached name only or not available error when it is called outside the scope of DiscoverDevices.
Diffstat (limited to 'hcid/dbus-adapter.c')
-rw-r--r--hcid/dbus-adapter.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index e5f40d55..0466404f 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -1692,17 +1692,14 @@ static DBusHandlerResult adapter_get_remote_name(DBusConnection *conn,
if (!adapter->up)
return error_not_ready(conn, msg);
- /* put the request name in the queue to resolve name */
+ /* If the discover process is not running, return an error */
+ if (!adapter->discov_active && !adapter->pdiscov_active)
+ return error_not_available(conn, msg);
+
+ /* Queue the request when there is a discovery running */
str2ba(peer_addr, &peer_bdaddr);
found_device_add(&adapter->found_devices, &peer_bdaddr, 0, NAME_REQUIRED);
- /*
- * if there is a discover process running, just queue the request.
- * Otherwise, send the HCI cmd to get the remote name
- */
- if (!(adapter->discov_active || adapter->pdiscov_active))
- found_device_req_name(adapter);
-
return error_request_deferred(conn, msg);
}