#include "response-sched.h"
#include "util.h"
+#include "log.h"
-#define AVAHI_RESPONSE_HISTORY_MSEC 700
+#define AVAHI_RESPONSE_HISTORY_MSEC 500
#define AVAHI_RESPONSE_DEFER_MSEC 20
#define AVAHI_RESPONSE_JITTER_MSEC 100
#define AVAHI_RESPONSE_SUPPRESS_MSEC 700
if (!packet_add_response_job(s, p, rj)) {
avahi_dns_packet_free(p);
- g_warning("Record too large, cannot send");
+ avahi_log_warn("Record too large, cannot send");
job_mark_done(s, rj);
return;
}
if (avahi_record_equal_no_ttl(rj->record, record)) {
/* Check whether this entry is outdated */
- if (avahi_age(&rj->delivery) > AVAHI_RESPONSE_HISTORY_MSEC*1000) {
+/* avahi_log_debug("history age: %u", (unsigned) (avahi_age(&rj->delivery)/1000)); */
+
+ if (avahi_age(&rj->delivery)/1000 > AVAHI_RESPONSE_HISTORY_MSEC) {
/* it is outdated, so let's remove it */
job_free(s, rj);
return NULL;
gboolean avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record, gboolean flush_cache, const AvahiAddress *querier, gboolean immediately) {
AvahiResponseJob *rj;
GTimeVal tv;
+/* gchar *t; */
g_assert(s);
g_assert(record);
g_assert(!avahi_key_is_pattern(record->key));
+/* t = avahi_record_to_string(record); */
+/* avahi_log_debug("post %i %s", immediately, t); */
+/* g_free(t); */
+
/* Check whether this response is suppressed */
if (querier &&
(rj = find_suppressed_job(s, record, querier)) &&
avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) &&
rj->record->ttl >= record->ttl/2) {
- g_message("Response suppressed by known answer suppression.");
+/* avahi_log_debug("Response suppressed by known answer suppression."); */
return FALSE;
}
if (avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) &&
rj->record->ttl >= record->ttl/2 &&
(rj->flush_cache || !flush_cache)) {
- g_message("Response suppressed by local duplicate suppression (history)");
+/* avahi_log_debug("Response suppressed by local duplicate suppression (history)"); */
return FALSE;
}
avahi_elapse_time(&tv, immediately ? 0 : AVAHI_RESPONSE_DEFER_MSEC, immediately ? 0 : AVAHI_RESPONSE_JITTER_MSEC);
if ((rj = find_scheduled_job(s, record))) {
- g_message("Response suppressed by local duplicate suppression (scheduled)");
+/* avahi_log_debug("Response suppressed by local duplicate suppression (scheduled)"); */
/* Update a little ... */
return TRUE;
} else {
- g_message("Accepted new response job.");
+/* avahi_log_debug("Accepted new response job."); */
/* Create a new job and schedule it */
rj = job_new(s, record, AVAHI_SCHEDULED);
record->ttl >= rj->record->ttl/2) { /* sensible TTL */
/* A matching entry was found, so let's mark it done */
- g_message("Response suppressed by distributed duplicate suppression");
+/* avahi_log_debug("Response suppressed by distributed duplicate suppression"); */
job_mark_done(s, rj);
}
record->ttl >= rj->record->ttl/2) { /* sensible TTL */
/* A matching entry was found, so let's drop it */
- g_message("Known answer suppression active!");
+/* avahi_log_debug("Known answer suppression active!"); */
job_free(s, rj);
}
}