+static void register_time_event_callback(AvahiTimeEvent *e, gpointer userdata) {
+ AvahiServer *s = userdata;
+
+ g_assert(e);
+ g_assert(s);
+
+ g_assert(e == s->register_time_event);
+ avahi_time_event_queue_remove(s->time_event_queue, s->register_time_event);
+ s->register_time_event = NULL;
+
+ if (s->state == AVAHI_SERVER_SLEEPING)
+ register_stuff(s);
+}
+
+static void delayed_register_stuff(AvahiServer *s) {
+ GTimeVal tv;
+
+ g_assert(s);
+
+ avahi_elapse_time(&tv, AVAHI_HOST_RR_HOLDOFF_MSEC, 0);
+
+ if (s->register_time_event)
+ avahi_time_event_queue_update(s->time_event_queue, s->register_time_event, &tv);
+ else
+ s->register_time_event = avahi_time_event_queue_add(s->time_event_queue, &tv, register_time_event_callback, s);
+}
+