There is only 1 place in project calling this function with the match
argument. It's easier to add prooper condition in this place and have
service_reply_single simplified by taking 1 less argument.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-service_reply_single(struct interface *iface, struct service *s, const char *match, int ttl, int force)
+service_reply_single(struct interface *iface, struct service *s, int ttl, int force)
{
const char *host = service_name(s->service);
char *service = strstr(host, "._");
{
const char *host = service_name(s->service);
char *service = strstr(host, "._");
- if (match && strcmp(match, s->service))
- return;
-
s->t = t;
dns_init_answer();
s->t = t;
dns_init_answer();
- vlist_for_each_element(&services, s, node)
- service_reply_single(iface, s, match, ttl, 0);
+ vlist_for_each_element(&services, s, node) {
+ if (!match || !strcmp(s->service, match))
+ service_reply_single(iface, s, ttl, 0);
+ }
if (service_init_announce)
vlist_for_each_element(&interfaces, iface, node) {
s->t = 0;
if (service_init_announce)
vlist_for_each_element(&interfaces, iface, node) {
s->t = 0;
- service_reply_single(iface, s, NULL, announce_ttl, 1);
+ service_reply_single(iface, s, announce_ttl, 1);
s = container_of(node_old, struct service, node);
if (!node_new && service_init_announce)
vlist_for_each_element(&interfaces, iface, node)
s = container_of(node_old, struct service, node);
if (!node_new && service_init_announce)
vlist_for_each_element(&interfaces, iface, node)
- service_reply_single(iface, s, NULL, 0, 1);
+ service_reply_single(iface, s, 0, 1);