/* Let's keep a reference to the query while we're operating */
keep_c = dns_query_candidate_ref(c);
+ uint64_t generation = c->generation;
+
/* Start the transactions that are not started yet */
SET_FOREACH(t, c->transactions) {
if (t->state != DNS_TRANSACTION_NULL)
if (r < 0)
return r;
+ if (c->generation != generation)
+ /* The transaction has been completed, and dns_transaction_complete() ->
+ * dns_query_candidate_notify() has been already called. Moreover, the query
+ * candidate has been regenerated, and the query should be already restarted.
+ * Let's exit from the loop now. */
+ return 0;
+
n++;
}
dns_query_candidate_stop(c);
+ c->generation++;
+
if (c->query->question_bypass) {
/* If this is a bypass query, then pass the original query packet along to the transaction */