Ignore:
Timestamp:
Dec 24, 2014 5:46:51 AM (9 years ago)
Author:
nanang
Message:

Ticket #1809: Fixed DNS SRV resolver bug that application callback may be called twice.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/src/pjlib-util/srv_resolver.c

    r4774 r4971  
    406406static pj_status_t resolve_hostnames(pj_dns_srv_async_query *query_job) 
    407407{ 
    408     unsigned i; 
     408    unsigned i, err_cnt = 0; 
    409409    pj_status_t err=PJ_SUCCESS, status; 
    410410 
     
    421421        srv->parent = query_job; 
    422422 
     423        /* See also #1809: dns_callback() will be invoked synchronously when response 
     424         * is available in the cache, and var 'query_job->host_resolved' will get 
     425         * incremented within the dns_callback(), which will cause this function 
     426         * returning false error, so don't use that variable for counting errors. 
     427         */ 
    423428        status = pj_dns_resolver_start_query(query_job->resolver, 
    424429                                             &srv->target_name, 
     
    428433        if (status != PJ_SUCCESS) { 
    429434            query_job->host_resolved++; 
     435            err_cnt++; 
    430436            err = status; 
    431437        } 
    432438    } 
    433439     
    434     return (query_job->host_resolved == query_job->srv_cnt) ? err : PJ_SUCCESS; 
     440    return (err_cnt == query_job->srv_cnt) ? err : PJ_SUCCESS; 
    435441} 
    436442 
Note: See TracChangeset for help on using the changeset viewer.