Changeset 5475
- Timestamp:
- Oct 28, 2016 6:25:03 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c
r5473 r5475 1472 1472 ttl = resolver->settings.cache_max_ttl; 1473 1473 1474 /* Get a cache response entry */ 1475 cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key, 1476 sizeof(*key), &hval); 1477 1474 1478 /* If TTL is zero, clear the same entry in the hash table */ 1475 1479 if (ttl == 0) { 1476 cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key,1477 sizeof(*key), &hval);1478 1480 /* Remove the entry before releasing its pool (see ticket #1710) */ 1479 1481 pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL); … … 1485 1487 } 1486 1488 1487 /* Get a cache response entry */1488 cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key,1489 sizeof(*key), &hval);1490 1489 if (cache == NULL) { 1491 cache = alloc_entry(resolver);1492 } else if (cache->ref_cnt > 1) {1493 /* When cache entry is being used by callback (to app), just decrement1494 * ref_cnt so it will be freed after the callback returns and allocate1495 * new entry.1496 */1497 cache->ref_cnt--;1498 1490 cache = alloc_entry(resolver); 1499 1491 } else { … … 1501 1493 pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL); 1502 1494 1503 /* Reset cache to avoid bloated cache pool */ 1504 reset_entry(&cache); 1495 if (cache->ref_cnt > 1) { 1496 /* When cache entry is being used by callback (to app), 1497 * just decrement ref_cnt so it will be freed after 1498 * the callback returns and allocate new entry. 1499 */ 1500 cache->ref_cnt--; 1501 cache = alloc_entry(resolver); 1502 } else { 1503 /* Reset cache to avoid bloated cache pool */ 1504 reset_entry(&cache); 1505 } 1505 1506 } 1506 1507
Note: See TracChangeset
for help on using the changeset viewer.