Explorar el Código

* 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 hace 17 años
padre
commit
36e056474e
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  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);