summaryrefslogtreecommitdiffstats
path: root/avahi-core/rrlist.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-11-13 16:36:33 +0000
committerLennart Poettering <lennart@poettering.net>2005-11-13 16:36:33 +0000
commitda75d1898a45c106a994cd87f8da5b6bcb2b6450 (patch)
tree2c0016b9908d4f3816e3c5ee609a12292423293a /avahi-core/rrlist.c
parentc9d4620346b561e7eac4c04c070351710f195acc (diff)
* Make "NameAcquired" warning line disappear in avahi-client
Scheduler tweaks: * Add some more comments * Remove scheduled queries from the query queue if the querier which issued them dies. This reduces traffic immensly when many short lived queries are made, e.g. during host name lookups. * Don't free a querier object immediately when it is no longer referenced. Instead keep it and try to recycle it in case someone else wants to do the same query later on. Free it at the latest moment possible: just before the next query is scheduled to be made. This reduces traffic immensly when many short lived queries are made. With these two changes we can minimize the traffic to zero or near zero for many simple lookups. * When responding records with the FLUSH_CACHE bit set, reply immediately only when all response record have this bit set. Prior to this change we replied imediately as soon as one record hat this bit set. This change should make us pass *all* Bonjour mDNS conformance tests without any exceptions. git-svn-id: file:///home/lennart/svn/public/avahi/trunk@954 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core/rrlist.c')
-rw-r--r--avahi-core/rrlist.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/avahi-core/rrlist.c b/avahi-core/rrlist.c
index 9d76684..915ecbb 100644
--- a/avahi-core/rrlist.c
+++ b/avahi-core/rrlist.c
@@ -43,10 +43,11 @@ struct AvahiRecordListItem {
AVAHI_LLIST_FIELDS(AvahiRecordListItem, items);
};
-
struct AvahiRecordList {
AVAHI_LLIST_HEAD(AvahiRecordListItem, read);
AVAHI_LLIST_HEAD(AvahiRecordListItem, unread);
+
+ int all_flush_cache;
};
AvahiRecordList *avahi_record_list_new(void) {
@@ -59,6 +60,8 @@ AvahiRecordList *avahi_record_list_new(void) {
AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->read);
AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->unread);
+
+ l->all_flush_cache = 1;
return l;
}
@@ -89,9 +92,11 @@ void avahi_record_list_flush(AvahiRecordList *l) {
item_free(l, l->read);
while (l->unread)
item_free(l, l->unread);
+
+ l->all_flush_cache = 1;
}
-AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *flush_cache, int *unicast_response, int *auxiliary) {
+AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, int *ret_unicast_response, int *ret_auxiliary) {
AvahiRecord *r;
AvahiRecordListItem *i;
@@ -101,12 +106,12 @@ AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *flush_cache, int *u
assert(!i->read);
r = avahi_record_ref(i->record);
- if (unicast_response)
- *unicast_response = i->unicast_response;
- if (flush_cache)
- *flush_cache = i->flush_cache;
- if (auxiliary)
- *auxiliary = i->auxiliary;
+ if (ret_unicast_response)
+ *ret_unicast_response = i->unicast_response;
+ if (ret_flush_cache)
+ *ret_flush_cache = i->flush_cache;
+ if (ret_auxiliary)
+ *ret_auxiliary = i->auxiliary;
AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->unread, i);
AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->read, i);
@@ -153,6 +158,8 @@ void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache,
i->record = avahi_record_ref(r);
i->read = 0;
+ l->all_flush_cache = l->all_flush_cache && flush_cache;
+
AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->unread, i);
}
@@ -173,3 +180,11 @@ int avahi_record_list_is_empty(AvahiRecordList *l) {
return !l->unread && !l->read;
}
+
+int avahi_record_list_all_flush_cache(AvahiRecordList *l) {
+ assert(l);
+
+ /* Return TRUE if all entries in this list have flush_cache set */
+
+ return l->all_flush_cache;
+}