diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2016-06-29 09:19:01 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2016-06-29 09:19:01 +0000 |
commit | ad4c05bd3f16f4a70e81cdf253d4a1e5c7fc50f1 (patch) | |
tree | 0b68ba2be20a6d255ce92227e6c53af469b1fdcf /pjsip | |
parent | 74f90c7fc1e5029c20fff75f40054cee41df0ff1 (diff) |
Re #1926: Fixed bug of premature app callback invocation in DNS A+AAAA resolution when DNS A record is available in the cache.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5369 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsip/sip_resolve.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pjsip/src/pjsip/sip_resolve.c b/pjsip/src/pjsip/sip_resolve.c index e97123d6..231a98d8 100644 --- a/pjsip/src/pjsip/sip_resolve.c +++ b/pjsip/src/pjsip/sip_resolve.c @@ -217,10 +217,15 @@ PJ_DEF(void) pjsip_resolve( pjsip_resolver_t *resolver, * really tell the address family type, except when IPv6 flag is * explicitly set. */ +#if defined(PJ_HAS_IPV6) && PJ_HAS_IPV6==1 if ((ip_addr_ver == 6) || (type & PJSIP_TRANSPORT_IPV6)) af = pj_AF_INET6(); else if (ip_addr_ver == 4) af = pj_AF_INET(); +#else + /* IPv6 is disabled, will resolving IPv6 address be useful? */ + af = pj_AF_INET(); +#endif /* Set the transport type if not explicitly specified. * RFC 3263 section 4.1 specify rules to set up this. @@ -430,6 +435,15 @@ PJ_DEF(void) pjsip_resolve( pjsip_resolver_t *resolver, /* Resolve DNS A record if address family is not fixed to IPv6 */ if (af != pj_AF_INET6()) { + + /* If there will be DNS AAAA query too, let's setup a dummy one + * here, otherwise app callback may be called immediately (before + * DNS AAAA query is sent) when DNS A record is available in the + * cache. + */ + if (af == pj_AF_UNSPEC()) + query->object6 = (pj_dns_async_query*)0x1; + status = pj_dns_resolver_start_query(resolver->res, &query->naptr[0].name, PJ_DNS_TYPE_A, 0, |