In tau_dnr.c, in the function tau_uri2Addr() :
Everytime a new URI is requested to be resolved, an entry is made in the cache with its corresponding IP address 0 as default. This IP address is then updated on the callback of TCN DNS Reply.
typedef struct tau_dnr_data
{
TRDP_IP_ADDR_T dnsIpAddr; /**< IP address of the resolver */
UINT16 dnsPort; /**< 53 for standard DNS or 17225 for TCN-DNS */
UINT8 timeout; /**< timeout for requests (in seconds) */
TRDP_DNR_OPTS_T useTCN_DNS; /**< how to use TCN DNR */
UINT32 noOfCachedEntries; /**< no of items currently in the cache */
TAU_DNR_ENTRY_T cache[TAU_MAX_NO_CACHE_ENTRY]; /**< if != 0 use TCN DNS as resolver */
} TAU_DNR_DATA_T;
But in case of Timeout in receiving the DNS Reply (comId 141), or, in case the DNS server was not able to resolve the URI, the newly added entry in the cache, is left like that with its corresponding IP address as 0.
In such scenario, while checking the cache for a certain URI, it should be made sure that this cache entry has a proper IP and 0 should not be considered as valid IP address.
pTemp = (TAU_DNR_ENTRY_T *) vos_bsearch(pUri, pDNR->cache, pDNR->noOfCachedEntries, sizeof(TAU_DNR_ENTRY_T),
compareURI);
if ((pTemp != NULL) &&
((pTemp->fixedEntry == TRUE) ||
(pTemp->etbTopoCnt == appHandle->etbTopoCnt) || /* Do the topocounts match? */
(pTemp->opTrnTopoCnt == appHandle->opTrnTopoCnt) ||
((appHandle->etbTopoCnt == 0u) && (appHandle->opTrnTopoCnt == 0u)) /* Or do we not care? */
) &&
(pTemp->ipAddr != 0)) /* <<<----- THIS CHECK SHOULD BE ADDED */
{
*pAddr = pTemp->ipAddr;
return TRDP_NO_ERR;
}
Thank you Siddhi, you're correct. Can you please add that line?
Committed r1859