--- a/patches/avahi-03-entry.diff Fri Jan 21 09:04:27 2011 +0000
+++ b/patches/avahi-03-entry.diff Fri Jan 21 14:18:17 2011 +0000
@@ -1,6 +1,6 @@
---- /usr/tmp/clean/avahi-0.6.12/avahi-core/entry.c 2006-03-02 01:30:17.000000000 +0000
-+++ avahi-0.6.12/avahi-core/entry.c 2006-08-28 14:26:37.958555000 +0100
-@@ -52,6 +52,33 @@
+--- /usr/tmp/clean/avahi-0.6.28/avahi-core/entry.c 2010-08-26 01:51:38.985153000 +0100
++++ avahi-0.6.28/avahi-core/entry.c 2011-01-20 12:01:24.322248863 +0000
+@@ -50,6 +50,33 @@
#include "rr-util.h"
#include "domain-util.h"
@@ -34,7 +34,7 @@
static void transport_flags_from_domain(AvahiServer *s, AvahiPublishFlags *flags, const char *domain) {
assert(flags);
assert(domain);
-@@ -71,13 +98,146 @@
+@@ -69,13 +96,146 @@
*flags |= AVAHI_PUBLISH_USE_WIDE_AREA;
}
@@ -181,7 +181,7 @@
/* Remove from linked list */
AVAHI_LLIST_REMOVE(AvahiEntry, entries, s->entries, e);
-@@ -104,6 +264,15 @@
+@@ -102,6 +262,15 @@
while (g->entries)
avahi_entry_free(s, g->entries);
@@ -197,17 +197,17 @@
if (g->register_time_event)
avahi_time_event_free(g->register_time_event);
-@@ -141,6 +310,21 @@
+@@ -139,6 +308,21 @@
s->need_entry_cleanup = 0;
}
+#ifdef HAVE_BONJOUR
+ if (s->need_service_cleanup) {
+ AvahiService *as, *next;
-+
++
+ for (as = s->services; as; as = next) {
+ next = as->services_next;
-+
++
+ if (as->dead)
+ avahi_service_free(s, as);
+ }
@@ -218,17 +218,8 @@
+
if (s->need_browser_cleanup)
avahi_browser_cleanup(s);
- }
-@@ -226,7 +410,7 @@
- int is_first = 1;
-
- /* Update and existing record */
--
-+
- /* Find the first matching entry */
- for (e = avahi_hashmap_lookup(s->entries_by_key, r->key); e; e = e->by_key_next) {
- if (!e->dead && e->group == g && e->interface == interface && e->protocol == protocol)
-@@ -237,8 +421,54 @@
+
+@@ -245,8 +429,54 @@
/* Hmm, nothing found? */
if (!e) {
@@ -283,7 +274,7 @@
}
/* Update the entry */
-@@ -248,6 +478,36 @@
+@@ -256,6 +486,36 @@
/* Announce our changes when needed */
if (!avahi_record_equal_no_ttl(old_record, r) && (!g || g->state != AVAHI_ENTRY_GROUP_UNCOMMITED)) {
@@ -320,7 +311,7 @@
/* Remove the old entry from all caches, if needed */
if (!(e->flags & AVAHI_PUBLISH_UNIQUE))
-@@ -255,6 +515,7 @@
+@@ -263,6 +523,7 @@
/* Reannounce our updated entry */
avahi_reannounce_entry(s, e);
@@ -328,7 +319,7 @@
}
/* If we were the first entry in the list, we need to update the key */
-@@ -265,6 +526,14 @@
+@@ -273,6 +534,14 @@
} else {
AvahiEntry *t;
@@ -342,13 +333,13 @@
+#endif
/* Add a new record */
-
-@@ -299,7 +568,69 @@
+
+@@ -307,7 +576,69 @@
if (g)
- AVAHI_LLIST_PREPEND(AvahiEntry, by_group, g->entries, e);
-
+ AVAHI_LLIST_PREPEND(AvahiEntry, by_group, g->entries, e);
+
+#ifdef HAVE_BONJOUR
-+ e->recordref = NULL;
++ e->recordref = NULL;
+ if (!g->record_connection) {
+ if (DNSServiceCreateConnection(&g->record_connection) != kDNSServiceErr_NoError) {
+ avahi_entry_free(s, e);
@@ -384,7 +375,7 @@
+ ret = DNSServiceRegisterRecord(g->record_connection,
+ &e->recordref,
+ bflags,
-+ interface == AVAHI_IF_UNSPEC ?
++ interface == AVAHI_IF_UNSPEC ?
+ kDNSServiceInterfaceIndexAny :
+ interface,
+ record_name,
@@ -413,19 +404,17 @@
}
return e;
-@@ -575,7 +906,10 @@
+@@ -583,6 +914,9 @@
AvahiRecord *r = NULL;
int ret = AVAHI_OK;
AvahiEntry *srv_entry = NULL, *txt_entry = NULL, *ptr_entry = NULL, *enum_entry = NULL;
--
+#ifdef HAVE_BONJOUR
+ AvahiService *as;
+#endif
-+
+
assert(s);
assert(type);
- assert(name);
-@@ -595,6 +929,36 @@
+@@ -603,6 +937,36 @@
if (!domain)
domain = s->domain_name;
@@ -462,7 +451,7 @@
if (!host)
host = s->host_name_fqdn;
-@@ -659,6 +1023,7 @@
+@@ -667,6 +1031,7 @@
ret = avahi_server_errno(s);
goto fail;
}
@@ -470,26 +459,7 @@
fail:
if (ret != AVAHI_OK && !(flags & AVAHI_PUBLISH_UPDATE)) {
-@@ -938,6 +1303,18 @@
- return e;
- }
-
-+#ifdef HAVE_BONJOUR
-+static void server_cleanup_time_event_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* userdata) {
-+ AvahiServer *s = userdata;
-+ assert(s);
-+
-+ avahi_time_event_free(s->cleanup_time_event);
-+ s->cleanup_time_event = NULL;
-+
-+ avahi_cleanup_dead_entries(s);
-+}
-+#endif
-+
- int avahi_server_add_dns_server_address(
- AvahiServer *s,
- AvahiSEntryGroup *g,
-@@ -1005,7 +1382,11 @@
+@@ -1013,7 +1378,11 @@
if (g->state == state)
return;
@@ -501,7 +471,7 @@
if (g->state == AVAHI_ENTRY_GROUP_ESTABLISHED) {
-@@ -1050,6 +1431,10 @@
+@@ -1063,6 +1432,10 @@
g->register_time.tv_sec = 0;
g->register_time.tv_usec = 0;
AVAHI_LLIST_HEAD_INIT(AvahiEntry, g->entries);
@@ -512,14 +482,14 @@
AVAHI_LLIST_PREPEND(AvahiSEntryGroup, groups, s->groups, g);
return g;
-@@ -1057,16 +1442,26 @@
+@@ -1087,16 +1460,26 @@
void avahi_s_entry_group_free(AvahiSEntryGroup *g) {
AvahiEntry *e;
+#ifdef HAVE_BONJOUR
+ AvahiService *s;
+#endif
-
+
assert(g);
assert(g->server);
@@ -539,15 +509,15 @@
if (g->register_time_event) {
avahi_time_event_free(g->register_time_event);
-@@ -1077,9 +1472,17 @@
-
+@@ -1107,11 +1490,17 @@
+
g->server->need_group_cleanup = 1;
g->server->need_entry_cleanup = 1;
+#ifdef HAVE_BONJOUR
+ g->server->need_service_cleanup = 1;
-+ if (!g->server->cleanup_time_event)
-+ g->server->cleanup_time_event = avahi_time_event_new(g->server->time_event_queue, NULL, server_cleanup_time_event_callback, g->server);
+#endif
+
+ schedule_cleanup(g->server);
}
static void entry_group_commit_real(AvahiSEntryGroup *g) {
@@ -557,7 +527,7 @@
assert(g);
gettimeofday(&g->register_time, NULL);
-@@ -1089,8 +1492,15 @@
+@@ -1121,8 +1510,15 @@
if (g->dead)
return;
@@ -573,7 +543,7 @@
}
static void entry_group_register_time_event_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* userdata) {
-@@ -1143,16 +1553,29 @@
+@@ -1175,16 +1571,28 @@
void avahi_s_entry_group_reset(AvahiSEntryGroup *g) {
AvahiEntry *e;
@@ -581,7 +551,7 @@
+ AvahiService *s;
+#endif
assert(g);
-
+
for (e = g->entries; e; e = e->by_group_next) {
if (!e->dead) {
+#ifndef HAVE_BONJOUR
@@ -597,13 +567,12 @@
+ s->dead = 1;
+ }
+ g->server->need_service_cleanup = 1;
-+ if (!g->server->cleanup_time_event)
-+ g->server->cleanup_time_event = avahi_time_event_new(g->server->time_event_queue, NULL, server_cleanup_time_event_callback, g->server);
+#endif
++
g->n_probing = 0;
-
+
avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_UNCOMMITED);
-@@ -1195,12 +1618,23 @@
+@@ -1222,12 +1630,23 @@
int avahi_s_entry_group_is_empty(AvahiSEntryGroup *g) {
AvahiEntry *e;