Changeset 1239 for pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c
- Timestamp:
- May 1, 2007 12:25:01 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c
r1031 r1239 244 244 245 245 /* Create pool and name */ 246 resv = pj_pool_zalloc(pool, sizeof(struct pj_dns_resolver));246 resv = PJ_POOL_ZALLOC_T(pool, struct pj_dns_resolver); 247 247 resv->pool = pool; 248 248 resv->udp_sock = PJ_INVALID_SOCKET; … … 338 338 it = pj_hash_first(resolver->hquerybyid, &it_buf); 339 339 while (it) { 340 pj_dns_async_query *q = pj_hash_this(resolver->hquerybyid, it); 340 pj_dns_async_query *q = (pj_dns_async_query *) 341 pj_hash_this(resolver->hquerybyid, it); 341 342 pj_dns_async_query *cq; 342 343 if (q->cb) … … 498 499 pj_bzero(q, sizeof(*q)); 499 500 } else { 500 q = pj_pool_zalloc(resolver->pool, sizeof(*q));501 q = PJ_POOL_ZALLOC_T(resolver->pool, pj_dns_async_query); 501 502 } 502 503 … … 658 659 */ 659 660 hval = 0; 660 cache = pj_hash_get(resolver->hrescache, &key, sizeof(key), &hval); 661 cache = (struct cached_res *) pj_hash_get(resolver->hrescache, &key, 662 sizeof(key), &hval); 661 663 if (cache) { 662 664 /* We've found a cached entry. */ … … 703 705 704 706 /* Next, check if we have pending query on the same resource */ 705 q = pj_hash_get(resolver->hquerybyres, &key, sizeof(key), NULL); 707 q = (pj_dns_async_query *) pj_hash_get(resolver->hquerybyres, &key, 708 sizeof(key), NULL); 706 709 if (q) { 707 710 /* Yes, there's another pending query to the same key. … … 942 945 /* If status is unsuccessful, clear the same entry from the cache */ 943 946 if (status != PJ_SUCCESS) { 944 cache = pj_hash_get(resolver->hrescache, key, sizeof(*key), &hval); 947 cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key, 948 sizeof(*key), &hval); 945 949 if (cache) 946 950 pj_list_push_back(&resolver->res_free_nodes, cache); … … 977 981 /* If TTL is zero, clear the same entry in the hash table */ 978 982 if (ttl == 0) { 979 cache = pj_hash_get(resolver->hrescache, key, sizeof(*key), &hval); 983 cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key, 984 sizeof(*key), &hval); 980 985 if (cache) 981 986 pj_list_push_back(&resolver->res_free_nodes, cache); … … 985 990 986 991 /* Get a cache response entry */ 987 cache = pj_hash_get(resolver->hrescache, key, sizeof(*key), &hval); 992 cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key, 993 sizeof(*key), &hval); 988 994 if (cache == NULL) { 989 995 if (!pj_list_empty(&resolver->res_free_nodes)) { … … 991 997 pj_list_erase(cache); 992 998 } else { 993 cache = pj_pool_zalloc(resolver->pool, sizeof(*cache));999 cache = PJ_POOL_ZALLOC_T(resolver->pool, struct cached_res); 994 1000 } 995 1001 } … … 1041 1047 PJ_UNUSED_ARG(timer_heap); 1042 1048 1043 q = entry->user_data;1049 q = (pj_dns_async_query *) entry->user_data; 1044 1050 resolver = q->resolver; 1045 1051 … … 1125 1131 1126 1132 1127 resolver = pj_ioqueue_get_user_data(key);1133 resolver = (pj_dns_resolver *) pj_ioqueue_get_user_data(key); 1128 1134 pj_mutex_lock(resolver->mutex); 1129 1135 … … 1188 1194 1189 1195 /* Find the query based on the transaction ID */ 1190 q = pj_hash_get(resolver->hquerybyid, &dns_pkt->hdr.id, 1196 q = (pj_dns_async_query*) 1197 pj_hash_get(resolver->hquerybyid, &dns_pkt->hdr.id, 1191 1198 sizeof(dns_pkt->hdr.id), NULL); 1192 1199 if (!q) { … … 1372 1379 it = pj_hash_first(resolver->hrescache, &itbuf); 1373 1380 while (it) { 1374 struct cached_res *cache = pj_hash_this(resolver->hrescache, it); 1381 struct cached_res *cache; 1382 cache = (struct cached_res*)pj_hash_this(resolver->hrescache, it); 1375 1383 PJ_LOG(3,(resolver->name.ptr, 1376 1384 " Type %s: %s", … … 1390 1398 while (it) { 1391 1399 struct pj_dns_async_query *q; 1392 q = pj_hash_this(resolver->hquerybyid, it);1400 q = (pj_dns_async_query*) pj_hash_this(resolver->hquerybyid, it); 1393 1401 PJ_LOG(3,(resolver->name.ptr, 1394 1402 " Type %s: %s",
Note: See TracChangeset
for help on using the changeset viewer.