diff options
author | Sebastien Estienne <sebastien.estienne@gmail.com> | 2005-09-29 22:44:52 +0000 |
---|---|---|
committer | Sebastien Estienne <sebastien.estienne@gmail.com> | 2005-09-29 22:44:52 +0000 |
commit | 0d63b51f3750c8004417a069ea6b8590c72efc78 (patch) | |
tree | eace22a30299520dc834728daaaada91f347488c /avahi-core | |
parent | 4483bcd6692d77449c017ccebbca47e6fa5e1f1a (diff) |
* merged the throttling fix from rev 651
git-svn-id: file:///home/lennart/svn/public/avahi/branches/working-0.5.x@659 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core')
-rw-r--r-- | avahi-core/server.c | 16 | ||||
-rw-r--r-- | avahi-core/server.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/avahi-core/server.c b/avahi-core/server.c index 59ab6c1..019a41a 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -2175,6 +2175,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) diff --git a/avahi-core/server.h b/avahi-core/server.h index 7384e98..01ee78b 100644 --- a/avahi-core/server.h +++ b/avahi-core/server.h @@ -84,6 +84,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); |