mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-02 18:22:04 +00:00
MINOR: resolvers: Use a function to remove answers attached to a resolution
resolv_purge_resolution_answer_records() must be used to removed all answers attached to a resolution. For now, it is only used when a resolution is released.
This commit is contained in:
parent
3e0600fbbf
commit
1dec5c7934
@ -43,6 +43,7 @@ int resolv_get_ip_from_response(struct resolv_response *r_res,
|
|||||||
void **newip, short *newip_sin_family,
|
void **newip, short *newip_sin_family,
|
||||||
void *owner);
|
void *owner);
|
||||||
|
|
||||||
|
void resolv_purge_resolution_answer_records(struct resolv_resolution *resolution);
|
||||||
int resolv_link_resolution(void *requester, int requester_type, int requester_locked);
|
int resolv_link_resolution(void *requester, int requester_type, int requester_locked);
|
||||||
void resolv_unlink_resolution(struct resolv_requester *requester);
|
void resolv_unlink_resolution(struct resolv_requester *requester);
|
||||||
void resolv_trigger_resolution(struct resolv_requester *requester);
|
void resolv_trigger_resolution(struct resolv_requester *requester);
|
||||||
|
@ -1683,11 +1683,21 @@ static struct resolv_resolution *resolv_pick_resolution(struct resolvers *resolv
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resolv_purge_resolution_answer_records(struct resolv_resolution *resolution)
|
||||||
|
{
|
||||||
|
struct resolv_answer_item *item, *itemback;
|
||||||
|
|
||||||
|
list_for_each_entry_safe(item, itemback, &resolution->response.answer_list, list) {
|
||||||
|
LIST_DEL(&item->list);
|
||||||
|
pool_free(resolv_answer_item_pool, item->ar_item);
|
||||||
|
pool_free(resolv_answer_item_pool, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Releases a resolution from its requester(s) and move it back to the pool */
|
/* Releases a resolution from its requester(s) and move it back to the pool */
|
||||||
static void resolv_free_resolution(struct resolv_resolution *resolution)
|
static void resolv_free_resolution(struct resolv_resolution *resolution)
|
||||||
{
|
{
|
||||||
struct resolv_requester *req, *reqback;
|
struct resolv_requester *req, *reqback;
|
||||||
struct resolv_answer_item *item, *itemback;
|
|
||||||
|
|
||||||
/* clean up configuration */
|
/* clean up configuration */
|
||||||
resolv_reset_resolution(resolution);
|
resolv_reset_resolution(resolution);
|
||||||
@ -1698,16 +1708,7 @@ static void resolv_free_resolution(struct resolv_resolution *resolution)
|
|||||||
LIST_DEL(&req->list);
|
LIST_DEL(&req->list);
|
||||||
req->resolution = NULL;
|
req->resolution = NULL;
|
||||||
}
|
}
|
||||||
|
resolv_purge_resolution_answer_records(resolution);
|
||||||
list_for_each_entry_safe(item, itemback, &resolution->response.answer_list, list) {
|
|
||||||
LIST_DEL(&item->list);
|
|
||||||
if (item->ar_item) {
|
|
||||||
pool_free(resolv_answer_item_pool, item->ar_item);
|
|
||||||
item->ar_item = NULL;
|
|
||||||
}
|
|
||||||
pool_free(resolv_answer_item_pool, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
LIST_DEL(&resolution->list);
|
LIST_DEL(&resolution->list);
|
||||||
pool_free(resolv_resolution_pool, resolution);
|
pool_free(resolv_resolution_pool, resolution);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user