Re: [PATCH 2/2] gresolv: Optimize the response parser

2013-02-18 Thread Patrik Flykt
On Fri, 2013-02-15 at 12:30 +0200, Tomasz Bursztyka wrote:
> It will check first if the response belongs to a query,
> before interpreting any of its content (rcode, count...).

Applied, thanks!

Patrik
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


[PATCH 2/2] gresolv: Optimize the response parser

2013-02-15 Thread Tomasz Bursztyka
It will check first if the response belongs to a query,
before interpreting any of its content (rcode, count...).
---
 gweb/gresolv.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gweb/gresolv.c b/gweb/gresolv.c
index 9505f67..864d2ad 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--;
 
-- 
1.8.1.2

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman