From: Radoslaw Jablonski <ext-jablonski.radoslaw@nokia.com>
To: linux-bluetooth@vger.kernel.org
Cc: Radoslaw Jablonski <ext-jablonski.radoslaw@nokia.com>
Subject: [PATCH 4/7 v3] Support for stop fetching data when maxlistcount is achieved
Date: Mon, 14 Feb 2011 11:19:48 +0200 [thread overview]
Message-ID: <1297675191-8046-4-git-send-email-ext-jablonski.radoslaw@nokia.com> (raw)
In-Reply-To: <1297675191-8046-1-git-send-email-ext-jablonski.radoslaw@nokia.com>
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)
---
plugins/phonebook-tracker.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index c80ee68..210799d 100644
--- a/plugins/phonebook-tracker.c
+++ b/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);
--
1.7.0.4
next prev parent reply other threads:[~2011-02-14 9:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-14 9:19 [PATCH 1/7 v3] Add return value to query tracker Radoslaw Jablonski
2011-02-14 9:19 ` [PATCH 2/7 v3] Add return value to reply_list_foreach_t in phonebook-tracker Radoslaw Jablonski
2011-02-14 9:19 ` [PATCH 3/7 v3] Remove unnecessary checking for num_fields in pull_contact Radoslaw Jablonski
2011-02-14 9:19 ` Radoslaw Jablonski [this message]
2011-02-14 9:19 ` [PATCH 5/7 v3] Add support for notyfying pbap about more parts from backend Radoslaw Jablonski
2011-02-14 9:19 ` [PATCH 6/7 v3] Introduction of phonebook_pull_read Radoslaw Jablonski
2011-02-14 9:19 ` [PATCH 7/7 v3] Support for multipart response sending from phonebook-tracker Radoslaw Jablonski
2011-02-15 14:21 ` [PATCH 1/7 v3] Add return value to query tracker Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1297675191-8046-4-git-send-email-ext-jablonski.radoslaw@nokia.com \
--to=ext-jablonski.radoslaw@nokia.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox