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 @@ -152,6 +152,8 @@ static int dns_query_candidate_go(DnsQueryCandidate *c) {
152152
153153 c -> query -> block_ready ++ ;
154154
155+ uint64_t generation = c -> generation ;
156+
155157 /* Start the transactions that are not started yet */
156158 SET_FOREACH (t , c -> transactions , i ) {
157159 if (t -> state != DNS_TRANSACTION_NULL )
@@ -166,6 +168,13 @@ static int dns_query_candidate_go(DnsQueryCandidate *c) {
166168 /* A transaction is complete. */
167169 notify = true;
168170
171+ if (c -> generation != generation )
172+ /* The transaction has been completed, and dns_transaction_complete() ->
173+ * dns_query_candidate_notify() has been already called. Moreover, the query
174+ * candidate has been regenerated, and the query should be already restarted.
175+ * Let's exit from the loop now. */
176+ return 0 ;
177+
169178 n ++ ;
170179 }
171180
@@ -257,6 +266,8 @@ static int dns_query_candidate_setup_transactions(DnsQueryCandidate *c) {
257266
258267 dns_query_candidate_stop (c );
259268
269+ c -> generation ++ ;
270+
260271 question = dns_query_question_for_protocol (c -> query , c -> scope -> protocol );
261272
262273 /* Create one transaction per question key */
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ struct DnsQueryCandidate {
2020 DnsSearchDomain * search_domain ;
2121
2222 int error_code ;
23+ uint64_t generation ;
2324 Set * transactions ;
2425
2526 LIST_FIELDS (DnsQueryCandidate , candidates_by_query );
You can’t perform that action at this time.
0 commit comments