summaryrefslogtreecommitdiff
path: root/obexd/plugins
diff options
context:
space:
mode:
authorRadoslaw Jablonski <ext-jablonski.radoslaw@nokia.com>2011-02-14 11:19:48 +0200
committerMarcel Holtmann <marcel@holtmann.org>2012-12-04 22:48:34 +0100
commite669d8363fbe3aee8261e18d721835c8f3467f54 (patch)
treecf33fcf32239712d3494992bf59b29688635751f /obexd/plugins
parent8f2b4ccfb4280ec022dd59f44c1bb661c832231b (diff)
downloadbluez-e669d8363fbe3aee8261e18d721835c8f3467f54.tar.gz
obexd: Support for stop fetching data when maxlistcount is achieved
When desired number of results has been already processed, then sending already collected data and stopping fetching more results from tracker (previously in this scenario unnecessarily processing data continued untill end of results in db)
Diffstat (limited to 'obexd/plugins')
-rw-r--r--obexd/plugins/phonebook-tracker.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index c80ee6852..210799d2b 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
@@ -1602,11 +1602,17 @@ static int pull_contacts(const char **reply, int num_fields, void *user_data)
last_index = params->liststartoffset + params->maxlistcount;
- if ((data->index <= params->liststartoffset ||
- data->index > last_index) &&
- params->maxlistcount > 0)
+ if (data->index <= params->liststartoffset)
return 0;
+ /* max number of results achieved - need send vcards data that was
+ * already collected and stop further data processing (these operations
+ * will be invoked in "done" section) */
+ if (data->index > last_index && params->maxlistcount > 0) {
+ DBG("Maxlistcount achieved");
+ goto done;
+ }
+
add_entry:
contact = g_new0(struct phonebook_contact, 1);
contact_init(contact, reply);