summaryrefslogtreecommitdiffstats
path: root/hcid/dbus.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2006-03-14 18:53:37 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2006-03-14 18:53:37 +0000
commit15553064885d4ff312ebc4fe2fe3e39e85f94ef2 (patch)
tree978f0ca6f2dfdb64839ecb599391d1d6e6cbd9a6 /hcid/dbus.c
parent55dc9d47e12b483f6495ae6eaeeb2a7be2a2f02a (diff)
Fixed cancel discovery: checking the discover state to cancel the inquiry or remote name request procedure
Diffstat (limited to 'hcid/dbus.c')
-rw-r--r--hcid/dbus.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/hcid/dbus.c b/hcid/dbus.c
index 18ed1386..2b7ba72b 100644
--- a/hcid/dbus.c
+++ b/hcid/dbus.c
@@ -573,9 +573,15 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local)
snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id);
if (dbus_connection_get_object_path_data(connection, path, (void *) &pdata)) {
- if (pdata->resolve_name)
+ if (pdata->discover_state == DISCOVER_RUNNING_WITH_NAMES) {
+ /* start name resolving */
+ pdata->discover_state = RESOLVING_NAMES;
+
if (!remote_name_resolve(pdata))
- goto failed; /* skip, send discovery complete after resolve all remote names */
+ goto failed; /* skip, sending the first name to resolve */
+ else
+ pdata->discover_state = DISCOVER_OFF; /* no names to resolve */
+ }
if (pdata->requestor_name) {
free(pdata->requestor_name);
@@ -704,12 +710,8 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, i
goto failed;
}
- if (!pdata->resolve_name)
- goto failed; /* skip - it is a normal request */
- else
+ if (pdata->discover_state == DISCOVER_RUNNING_WITH_NAMES)
remote_name_add(&pdata->discovered_devices, peer);
-
- goto failed;
}
failed:
@@ -803,7 +805,7 @@ request_next:
free(pdata->requestor_name);
pdata->requestor_name = NULL;
- pdata->resolve_name = 0;
+ pdata->discover_state = DISCOVER_OFF;
failed:
if (message)