- if (a->n_announced >= 3) {
- g_message("Enough announcements for record [%s]", t = flx_record_to_string(a->entry->record));
- g_free(t);
- remove_announcement(a->server, a);
- return;
+/* g_message("%i -- %u", a->state, a->n_iteration); */
+
+ if (a->state == FLX_PROBING && a->n_iteration >= 1) {
+ flx_interface_post_probe(a->interface, a->entry->record, FALSE);
+ } else if (a->state == FLX_ANNOUNCING && a->n_iteration >= 1)
+ flx_interface_post_response(a->interface, NULL, a->entry->record, a->entry->flags & FLX_SERVER_ENTRY_UNIQUE, TRUE);
+
+ a->n_iteration++;
+
+ if (a->state == FLX_PROBING) {
+
+ if (a->n_iteration == 1)
+ flx_elapse_time(&tv, 0, 250);
+ else
+ flx_elapse_time(&tv, 250, 0);
+
+ /* Probing done */
+ if (a->n_iteration >= 4) {
+ gchar *t;
+ g_message("Enough probes for record [%s]", t = flx_record_to_string(a->entry->record));
+ g_free(t);
+ a->state = FLX_ANNOUNCING;
+ a->n_iteration = 1;
+ }
+
+ } else if (a->state == FLX_ANNOUNCING) {
+
+ flx_elapse_time(&tv, a->sec_delay*1000, FLX_ANNOUNCEMENT_JITTER_MSEC);
+
+ if (a->n_iteration < 10)
+ a->sec_delay *= 2;
+
+ /* Announcing done */
+ if (a->n_iteration >= 4) {
+ gchar *t;
+ g_message("Enough announcements for record [%s]", t = flx_record_to_string(a->entry->record));
+ g_free(t);
+ remove_announcement(a->server, a);
+ return;
+ }