#include <config.h>
#endif
+#include <avahi-common/domain.h>
+
#include "probe-sched.h"
-#include "util.h"
+#include "timeval.h"
#include "log.h"
#define AVAHI_PROBE_HISTORY_MSEC 150
gboolean chosen; /* Use for packet assembling */
gboolean done;
- GTimeVal delivery;
+ struct timeval delivery;
AvahiRecord *record;
static void elapse_callback(AvahiTimeEvent *e, gpointer data);
static void job_set_elapse_time(AvahiProbeScheduler *s, AvahiProbeJob *pj, guint msec, guint jitter) {
- GTimeVal tv;
+ struct timeval tv;
g_assert(s);
g_assert(pj);
pj->done = TRUE;
job_set_elapse_time(s, pj, AVAHI_PROBE_HISTORY_MSEC, 0);
- g_get_current_time(&pj->delivery);
+ gettimeofday(&pj->delivery, NULL);
}
AvahiProbeScheduler *avahi_probe_scheduler_new(AvahiInterface *i) {
return FALSE;
/* Create the probe query */
- k = avahi_key_new(pj->record->key->name, pj->record->key->class, AVAHI_DNS_TYPE_ANY);
+ k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY);
b = !!avahi_dns_packet_append_key(p, k, FALSE);
g_assert(b);
continue;
/* Does the record match the probe? */
- if (k->class != pj->record->key->class || !avahi_domain_equal(k->name, pj->record->key->name))
+ if (k->clazz != pj->record->key->clazz || !avahi_domain_equal(k->name, pj->record->key->name))
continue;
/* This job wouldn't fit in */
p = avahi_dns_packet_new_query(size);
- k = avahi_key_new(pj->record->key->name, pj->record->key->class, AVAHI_DNS_TYPE_ANY);
+ k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY);
b = avahi_dns_packet_append_key(p, k, FALSE) && avahi_dns_packet_append_record(p, pj->record, FALSE, 0);
avahi_key_unref(k);
gboolean avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record, gboolean immediately) {
AvahiProbeJob *pj;
- GTimeVal tv;
+ struct timeval tv;
g_assert(s);
g_assert(record);
if ((pj = find_history_job(s, record)))
return FALSE;
-
+
avahi_elapse_time(&tv, immediately ? 0 : AVAHI_PROBE_DEFER_MSEC, 0);
if ((pj = find_scheduled_job(s, record))) {