Use A(AAA) when querying for domain on cache expire
[project/mdnsd.git] / cache.c
diff --git a/cache.c b/cache.c
index fa32465f953bb18a3577ef48282f70bc18050a12..756ae6859983c16653ddb7b26ca20101e72e57bb 100644 (file)
--- a/cache.c
+++ b/cache.c
@@ -89,7 +89,12 @@ cache_gc_timer(struct uloop_timeout *timeout)
                        continue;
                }
                s->refresh += 50;
-               dns_send_question(s->iface, s->entry, TYPE_PTR, 0);
+               if (cache_service_is_host(s)) {
+                       dns_send_question(s->iface, s->entry, TYPE_A, 0);
+                       dns_send_question(s->iface, s->entry, TYPE_AAAA, 0);
+               } else {
+                       dns_send_question(s->iface, s->entry, TYPE_PTR, 0);
+               }
        }
 
        uloop_timeout_set(timeout, 10000);
@@ -121,7 +126,7 @@ void cache_cleanup(struct interface *iface)
 }
 
 void
-cache_scan(void)
+cache_update(void)
 {
        struct interface *iface;
        struct cache_service *s;
@@ -143,6 +148,7 @@ cache_service(struct interface *iface, char *entry, int hlen, int ttl)
                if (!strcmp(s->entry, entry)) {
                        s->refresh = 50;
                        s->time = monotonic_time();
+                       s->ttl = ttl;
                        return s;
                }