From e47f6cf16e6d998670be00cf241a0224ccbfb713 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 10 Feb 2017 14:44:39 +0100 Subject: [PATCH] Avoid duplicated iteration over services when announcing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In function service_announce_services we iterate over services and handle every single one so calling service_reply which also iterates doesn't make sense. In simple cases it was just wasting CPU cycles. We got service, we were passing its name and we were looking for it again comparing names. In cases with one service available on few different ports it was worse. For every iterated service we were announcing that one and all other sharing the same name. It resulted in sending n^2 records. Signed-off-by: Rafał Miłecki Acked-by: John Crispin --- service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service.c b/service.c index 182b2b2..bb87aff 100644 --- a/service.c +++ b/service.c @@ -179,7 +179,7 @@ service_announce_services(struct interface *iface, const char *service, int ttl) else dns_send_answer(iface, sdudp); } - service_reply(iface, s->service, ttl); + service_reply_single(iface, s, ttl, 0); } } -- 2.25.1