mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
dns: Make query sets hold on to queries for their lifetime.
The query set documentation states that upon completion queries can be retrieved for the lifetime of the query set. This is a reasonable expectation but does not currently occur. This was originally done to resolve a circular reference between queries and query sets, but in practice the query can be kept. This change makes it so a query does not have a reference to the query set until it begins resolving. It also makes it so that the reference is given up upon the query being completed. This allows the queries to remain for the lifetime of the query set. As the query set on the query is only useful to the query set functionality and only for the lifetime that the query is resolving this is safe to do. ASTERISK-24994 #close Reported by: Joshua Colp Change-Id: I54e09c0cb45475896654e7835394524e816d1aa0
This commit is contained in:
@@ -131,9 +131,14 @@ static int query_set_resolve(struct ast_dns_query *query)
|
||||
static int query_set_cancel(struct ast_dns_query *query)
|
||||
{
|
||||
struct ast_dns_query_set *query_set = ast_dns_query_get_data(query);
|
||||
struct query_set_data *qsdata = query_set->user_data;
|
||||
struct query_set_data *qsdata;
|
||||
int res = -1;
|
||||
|
||||
if (!query_set) {
|
||||
return -1;
|
||||
}
|
||||
qsdata = query_set->user_data;
|
||||
|
||||
if (qsdata->cancel++ < qsdata->cancel_allowed) {
|
||||
res = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user