]> git.meshlink.io Git - catta/commitdiff
reset the the commit throttling counter for entry groups 5s afer they have been estab...
authorLennart Poettering <lennart@poettering.net>
Thu, 29 Sep 2005 16:25:44 +0000 (16:25 +0000)
committerLennart Poettering <lennart@poettering.net>
Thu, 29 Sep 2005 16:25:44 +0000 (16:25 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@651 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-core/server.c
avahi-core/server.h
docs/TODO

index 49821d8b65e8bfbf175b97791e3eba4eaea84dde..cdf31e82d2e448a8173513c303eae2e1bd1ae16e 100644 (file)
@@ -2274,6 +2274,22 @@ void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState
 
     assert(state <= AVAHI_ENTRY_GROUP_COLLISION);
 
+    if (g->state == AVAHI_ENTRY_GROUP_ESTABLISHED) {
+
+        /* If the entry group was established for a time longer then
+         * 5s, reset the establishment trial counter */
+        
+        if (avahi_age(&g->established_at) > 5000000)
+            g->n_register_try = 0;
+    }
+    
+    if (state == AVAHI_ENTRY_GROUP_ESTABLISHED)
+
+        /* If the entry group is now established, remember the time
+         * this happened */
+        
+        gettimeofday(&g->established_at, NULL);
+    
     g->state = state;
     
     if (g->callback)
index 3e439f97f178796764199a1a6e31bc921c421671..1723250ea4f9aa35a5b4f859220f26fcca49f775 100644 (file)
@@ -88,6 +88,8 @@ struct AvahiSEntryGroup {
     unsigned n_register_try;
     struct timeval register_time;
     AvahiTimeEvent *register_time_event;
+
+    struct timeval established_at;
     
     AVAHI_LLIST_FIELDS(AvahiSEntryGroup, groups);
     AVAHI_LLIST_HEAD(AvahiEntry, entries);
index 233d665ec94d9cb8612e92d58d0befd3d32ba10b..6a90889f33f97735b59c93822c15ef32855817eb 100644 (file)
--- a/docs/TODO
+++ b/docs/TODO
@@ -3,14 +3,12 @@ for 0.6:
 * add subtype browsing
 * add simplification routine for adding services 
 
-* remove queries from queue if the browse object they were issued from is destroyed
+* remove outgoing queries from queue if the browse object they were issued from is destroyed
 
 * add API to allow user to tell the server that some service is not reachable
 
 * Add static host configuration like static services [lathiat]
 
-* reset commit throttling for entry groups after a while
-
 * consolidate browsing failure events and add an API to query the reason
 
 * generate local CNAME responses
@@ -90,3 +88,4 @@ done:
 * add option to disable SO_REUSEADDR to disallow binding of multiple processes to port 5353
 * add flags argument to disable cookies-setting for local services
 * add API to add addresses without reverse PTR record
+* reset commit throttling for entry groups after a while