summaryrefslogtreecommitdiff
path: root/gweb
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2013-02-15 12:30:29 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-02-18 10:50:01 +0200
commit003947c67cc263406b97b8f69909cf0ba1786599 (patch)
tree7b7d9a81d2901eab6b20270ddbbd97f00e8ed51e /gweb
parent5441662cf582d86736f94ed42f68bec9a031e42f (diff)
downloadconnman-003947c67cc263406b97b8f69909cf0ba1786599.tar.gz
connman-003947c67cc263406b97b8f69909cf0ba1786599.tar.bz2
connman-003947c67cc263406b97b8f69909cf0ba1786599.zip
gresolv: Optimize the response parser
It will check first if the response belongs to a query, before interpreting any of its content (rcode, count...).
Diffstat (limited to 'gweb')
-rw-r--r--gweb/gresolv.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gweb/gresolv.c b/gweb/gresolv.c
index 9505f677..864d2adb 100644
--- a/gweb/gresolv.c
+++ b/gweb/gresolv.c
@@ -667,6 +667,11 @@ static void parse_response(struct resolv_nameserver *nameserver,
ns_initparse(buf, len, &msg);
+ list = g_queue_find_custom(resolv->query_queue,
+ GUINT_TO_POINTER(ns_msg_id(msg)), compare_query_msgid);
+ if (!list)
+ return;
+
rcode = ns_msg_getflag(msg, ns_f_rcode);
count = ns_msg_count(msg, ns_s_an);
@@ -697,11 +702,6 @@ static void parse_response(struct resolv_nameserver *nameserver,
break;
}
- list = g_queue_find_custom(resolv->query_queue,
- GUINT_TO_POINTER(ns_msg_id(msg)), compare_query_msgid);
- if (!list)
- return;
-
query = list->data;
query->nr_ns--;