return rj;
}
-void flx_packet_scheduler_post_response(flxPacketScheduler *s, flxRecord *record, gboolean immediately) {
+void flx_packet_scheduler_post_response(flxPacketScheduler *s, const flxAddress *a, flxRecord *record, gboolean immediately) {
flxResponseJob *rj;
GTimeVal tv;
gchar *t;
if (!!record->ttl == !!rj->record->ttl &&
d >= 0 && d <= FLX_RESPONSE_HISTORY_MSEC*1000) {
g_message("WARNING! DUPLICATE RESPONSE SUPPRESSION ACTIVE!");
+
+ /* This job is no longer specific to a single querier, so
+ * make sure it isn't suppressed by known answer
+ * suppresion */
+ rj->address_valid = FALSE;
+
return;
}
rj = response_job_new(s, record);
rj->delivery = tv;
rj->time_event = flx_time_event_queue_add(s->server->time_event_queue, &rj->delivery, response_elapse, rj);
+
+ /* Store the address of the host this messages is intended to, so
+ that we can drop this job in case a truncated message with
+ known answer suppresion entries is recieved */
+
+ if ((rj->address_valid = !!a))
+ rj->address = *a;
}
void flx_packet_scheduler_incoming_query(flxPacketScheduler *s, flxKey *key) {
g_get_current_time(&rj->delivery);
}
+void flx_packet_scheduler_incoming_known_answer(flxPacketScheduler *s, flxRecord *record, const flxAddress *a) {
+ flxResponseJob *rj;
+
+ g_assert(s);
+ g_assert(record);
+ g_assert(a);
+
+ for (rj = s->response_jobs; rj; rj = rj->jobs_next)
+ if (flx_record_equal_no_ttl(rj->record, record) &&
+ rj->address_valid &&
+ flx_address_cmp(&rj->address, a) &&
+ record->ttl >= rj->record->ttl/2) {
+
+ /* Let's suppress it */
+
+ response_job_free(s, rj);
+ break;
+ }
+
+}
+
void flx_packet_scheduler_flush_responses(flxPacketScheduler *s) {
flxResponseJob *rj;