Ver Fonte

* When cancelling the query due to timeout of not recieving all answers,
send all of the answers which did come to the callback.

Bryan Drewery há 17 anos atrás
pai
commit
36e056474e
1 ficheiros alterados com 10 adições e 1 exclusões
  1. 10 1
      src/adns.c

+ 10 - 1
src/adns.c

@@ -830,7 +830,16 @@ int egg_dns_cancel(int id, int issue_callback)
 	if (prev) prev->next = q->next;
 	else query_head = q->next;
 	sdprintf("Cancelling query: %s", q->query);
-	if (issue_callback) q->callback(q->id, q->client_data, q->query, NULL);
+	if (issue_callback) {
+		if (q->answer.len > 0) {
+			cache_add(q->query, &q->answer);
+
+			q->callback(q->id, q->client_data, q->query, q->answer.list);
+			answer_free(&q->answer);
+		} else {
+			q->callback(q->id, q->client_data, q->query, NULL);
+		}
+	}
 	if (q->ip)
 		free(q->ip);
 	free(q->query);