authd: add the ability to cancel DNS requests

This commit is contained in:
Elizabeth Myers 2016-03-12 07:10:27 -06:00
parent 399c633313
commit 45ac1e3ce6
2 changed files with 8 additions and 0 deletions

View file

@ -103,6 +103,13 @@ lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data)
return query; return query;
} }
/* Cancel a pending query */
static void
cancel_query(struct dns_query *query)
{
query->callback = query->data = NULL;
}
/* Callback from gethost_byname_type */ /* Callback from gethost_byname_type */
static void static void
handle_lookup_ip_reply(void *data, struct DNSReply *reply) handle_lookup_ip_reply(void *data, struct DNSReply *reply)

View file

@ -52,6 +52,7 @@ struct dns_query
extern struct dns_query *lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data); extern struct dns_query *lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data);
extern struct dns_query *lookup_ip(const char *host, int aftype, DNSCB callback, void *data); extern struct dns_query *lookup_ip(const char *host, int aftype, DNSCB callback, void *data);
extern static void cancel_query(struct dns_query *query);
extern void resolve_dns(int parc, char *parv[]); extern void resolve_dns(int parc, char *parv[]);
extern void enumerate_nameservers(const char *rid, const char letter); extern void enumerate_nameservers(const char *rid, const char letter);