static void next_state(flxAnnouncement *a) {
g_assert(a);
- g_message("%i -- %u", a->state, a->n_iteration);
+/* g_message("%i -- %u", a->state, a->n_iteration); */
if (a->state == FLX_WAITING) {
}
static flxRecord *make_goodbye_record(flxRecord *r) {
- gchar *t;
+/* gchar *t; */
flxRecord *g;
g_assert(r);
- g_message("Preparing goodbye for record [%s]", t = flx_record_to_string(r));
- g_free(t);
+/* g_message("Preparing goodbye for record [%s]", t = flx_record_to_string(r)); */
+/* g_free(t); */
g = flx_record_copy(r);
g_assert(g->ref == 1);
g_assert(s);
g_assert(i);
- g_message("goodbye interface: %s.%u", i->hardware->name, i->protocol);
+/* g_message("goodbye interface: %s.%u", i->hardware->name, i->protocol); */
if (goodbye && flx_interface_relevant(i)) {
flxEntry *e;
while (i->announcements)
remove_announcement(s, i->announcements);
- g_message("goodbye interface done: %s.%u", i->hardware->name, i->protocol);
+/* g_message("goodbye interface done: %s.%u", i->hardware->name, i->protocol); */
}
g_assert(s);
g_assert(e);
- g_message("goodbye entry: %p", e);
+/* g_message("goodbye entry: %p", e); */
if (goodbye && !e->dead)
flx_interface_monitor_walk(s->monitor, 0, AF_UNSPEC, send_goodbye_callback, e);
while (e->announcements)
remove_announcement(s, e->announcements);
- g_message("goodbye entry done: %p", e);
+/* g_message("goodbye entry done: %p", e); */
}
g_assert(s);
- g_message("goodbye all");
+/* g_message("goodbye all"); */
for (e = s->entries; e; e = e->entries_next)
if (!e->dead)
flx_goodbye_entry(s, e, goodbye);
- g_message("goodbye all done");
+/* g_message("goodbye all done"); */
}
#define FLX_RESPONSE_HISTORY_MSEC 700
#define FLX_RESPONSE_DEFER_MSEC 20
#define FLX_RESPONSE_JITTER_MSEC 100
-#define FLX_PROBE_DEFER_MSEC 20
+#define FLX_PROBE_DEFER_MSEC 70
flxPacketScheduler *flx_packet_scheduler_new(flxServer *server, flxInterface *i) {
flxPacketScheduler *s;
response_job_free(s, rj);
}
- g_message("ACCEPTED NEW RESPONSE [%s]", t = flx_record_to_string(record));
- g_free(t);
+/* g_message("ACCEPTED NEW RESPONSE [%s]", t = flx_record_to_string(record)); */
+/* g_free(t); */
/* Create a new job and schedule it */
rj = response_job_new(s, record);
g_assert(a);
g_assert(b);
+/* gchar *t; */
+
+/* g_message("comparing [%s]", t = flx_record_to_string(a)); */
+/* g_free(t); */
+
+/* g_message("and [%s]", t = flx_record_to_string(b)); */
+/* g_free(t); */
+
if (a->key->class < b->key->class)
return -1;
else if (a->key->class > b->key->class)
case FLX_DNS_TYPE_SRV: {
gint r;
- if ((r = uint16_cmp(a->data.srv.priority, b->data.srv.priority)) != 0 ||
- (r = uint16_cmp(a->data.srv.weight, b->data.srv.weight)) != 0 ||
- (r = uint16_cmp(a->data.srv.port, b->data.srv.port)) != 0)
+ if ((r = uint16_cmp(a->data.srv.priority, b->data.srv.priority)) == 0 &&
+ (r = uint16_cmp(a->data.srv.weight, b->data.srv.weight)) == 0 &&
+ (r = uint16_cmp(a->data.srv.port, b->data.srv.port)) == 0)
r = lexicographical_domain_cmp(a->data.srv.name, b->data.srv.name);
return r;
}
s->need_entry_cleanup = TRUE;
-
}
static void incoming_probe(flxServer *s, flxRecord *record, flxInterface *i) {
t = flx_record_to_string(record);
- g_message("PROBE! PROBE! PROBE! [%s]", t);
-
+/* g_message("PROBE: [%s]", t); */
+
for (e = g_hash_table_lookup(s->entries_by_key, record->key); e; e = n) {
n = e->by_key_next;
-
- if (e->dead || !flx_record_equal_no_ttl(record, e->record))
+
+ if (e->dead || flx_record_equal_no_ttl(record, e->record))
continue;
if (flx_entry_registering(s, e, i)) {
gint cmp;
-
+
if ((cmp = flx_record_lexicographical_compare(record, e->record)) > 0) {
withdraw_entry(s, e);
g_message("Recieved conflicting probe [%s]. Local host lost. Withdrawing.", t);
} else if (cmp < 0)
g_message("Recieved conflicting probe [%s]. Local host won.", t);
+
}
}
t = flx_record_to_string(record);
- g_message("CHECKING FOR CONFLICT: [%s]", t);
+/* g_message("CHECKING FOR CONFLICT: [%s]", t); */
for (e = g_hash_table_lookup(s->entries_by_key, record->key); e; e = n) {
n = e->by_key_next;
uname(&utsname);
r->data.hinfo.cpu = g_strdup(g_strup(utsname.machine));
r->data.hinfo.os = g_strdup(g_strup(utsname.sysname));
- flx_server_add(s, NULL, 0, AF_UNSPEC, FLX_ENTRY_UNIQUE | FLX_ENTRY_NOANNOUNCE | FLX_ENTRY_NOPROBE, r);
+ flx_server_add(s, NULL, 0, AF_UNSPEC, FLX_ENTRY_UNIQUE, r);
flx_record_unref(r);
/* Add localhost entries */