File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,8 @@ static int dns_query_candidate_go(DnsQueryCandidate *c) {
199
199
/* Let's keep a reference to the query while we're operating */
200
200
keep_c = dns_query_candidate_ref (c );
201
201
202
+ uint64_t generation = c -> generation ;
203
+
202
204
/* Start the transactions that are not started yet */
203
205
SET_FOREACH (t , c -> transactions ) {
204
206
if (t -> state != DNS_TRANSACTION_NULL )
@@ -208,6 +210,13 @@ static int dns_query_candidate_go(DnsQueryCandidate *c) {
208
210
if (r < 0 )
209
211
return r ;
210
212
213
+ if (c -> generation != generation )
214
+ /* The transaction has been completed, and dns_transaction_complete() ->
215
+ * dns_query_candidate_notify() has been already called. Moreover, the query
216
+ * candidate has been regenerated, and the query should be already restarted.
217
+ * Let's exit from the loop now. */
218
+ return 0 ;
219
+
211
220
n ++ ;
212
221
}
213
222
@@ -271,6 +280,8 @@ static int dns_query_candidate_setup_transactions(DnsQueryCandidate *c) {
271
280
272
281
dns_query_candidate_stop (c );
273
282
283
+ c -> generation ++ ;
284
+
274
285
if (c -> query -> question_bypass ) {
275
286
/* If this is a bypass query, then pass the original query packet along to the transaction */
276
287
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ typedef struct DnsStubListenerExtra DnsStubListenerExtra;
18
18
struct DnsQueryCandidate {
19
19
unsigned n_ref ;
20
20
int error_code ;
21
+ uint64_t generation ;
21
22
22
23
DnsQuery * query ;
23
24
DnsScope * scope ;
You can’t perform that action at this time.
0 commit comments