resolved: simplify initialization of DnsScope
authorLennart Poettering <lennart@poettering.net>
Tue, 3 Sep 2024 08:45:26 +0000 (10:45 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 11 Sep 2024 19:35:47 +0000 (21:35 +0200)
src/resolve/resolved-dns-scope.c

index 4d4e952dac43f2e61e8834bc25d95f08d404ba3a..5292b11405c8739f21614f27456d1d70c4d81108 100644 (file)
@@ -42,7 +42,9 @@ int dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol protocol, int
                 .protocol = protocol,
                 .family = family,
                 .resend_timeout = MULTICAST_RESEND_TIMEOUT_MIN_USEC,
-                .mdns_goodbye_event_source = NULL,
+
+                /* Enforce ratelimiting for the multicast protocols */
+                .ratelimit = { MULTICAST_RATELIMIT_INTERVAL_USEC, MULTICAST_RATELIMIT_BURST },
         };
 
         if (protocol == DNS_PROTOCOL_DNS) {
@@ -72,9 +74,6 @@ int dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol protocol, int
 
         log_debug("New scope on link %s, protocol %s, family %s", l ? l->ifname : "*", dns_protocol_to_string(protocol), family == AF_UNSPEC ? "*" : af_to_name(family));
 
-        /* Enforce ratelimiting for the multicast protocols */
-        s->ratelimit = (const RateLimit) { MULTICAST_RATELIMIT_INTERVAL_USEC, MULTICAST_RATELIMIT_BURST };
-
         *ret = s;
         return 0;
 }