Avoid duplicated iteration over services when announcing
authorRafał Miłecki <rafal@milecki.pl>
Fri, 10 Feb 2017 13:44:39 +0000 (14:44 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Fri, 10 Feb 2017 14:19:33 +0000 (15:19 +0100)
commite47f6cf16e6d998670be00cf241a0224ccbfb713
tree1ccdef89b83dc6e947a95ab55c08f68af8582749
parenta069fbbd11394ec5b8a32e28ff9b6c9d8d6b07c4
Avoid duplicated iteration over services when announcing

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 <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
service.c