]> git.meshlink.io Git - catta/blobdiff - avahi-core/server.c
reset the the commit throttling counter for entry groups 5s afer they have been estab...
[catta] / avahi-core / server.c
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)