Commit 05c6aba8 authored by Pekka Pessi's avatar Pekka Pessi

s2check: fixed s2_dns_teardown()

Clearing default_domain, too.
parent 2894d6bb
......@@ -26,6 +26,8 @@ static struct s2dns {
void *userdata;
} s2dns;
static char const *default_domain;
static
struct s2_dns_response {
struct s2_dns_response *next;
......@@ -114,9 +116,20 @@ void
s2_dns_teardown(void)
{
struct s2_dns_response *r, *next;
su_root_deregister(s2dns.root, s2dns.reg), s2dns.reg = -1;
int rv;
if (s2dns.root == NULL)
return;
default_domain = NULL;
assert(s2dns.reg > 0);
rv = su_root_deregister(s2dns.root, s2dns.reg), s2dns.reg = -1;
assert(rv != -1);
su_wait_destroy(s2dns.wait);
su_close(s2dns.socket), s2dns.socket = -1;
s2dns.root = NULL;
memset(&s2dns, 0, sizeof s2dns);
for (r = zonedata, zonedata = NULL; r; r = next) {
next = r->next;
......@@ -193,8 +206,6 @@ s2_dns_query(su_root_magic_t *magic,
return 0;
}
static char const *default_domain;
/** Set default domain suffix used with s2_dns_record() */
char const *
s2_dns_default(char const *domain)
......@@ -571,7 +582,7 @@ void s2_dns_domain(char const *domain, int use_naptr,
/** Insert DNS response.
s2_dns_record("example.com", sres_type_naptr,
s2_dns_record("example.com.", sres_type_naptr,
// order priority flags services regexp target
"", sres_type_naptr, 20, 50, "a", "SIP+D2U", "", "sip00",
"", sres_type_naptr, 20, 50, "a", "SIP+D2T", "", "sip00",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment