From: Lennart Poettering Date: Thu, 24 Aug 2006 21:02:46 +0000 (+0000) Subject: If the client calls EntryGroup::Commit update the local state immediately and X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=8a0e03b4fc8687a91b9a6800145e613c3a009247;p=catta If the client calls EntryGroup::Commit update the local state immediately and do not delay this until the server informed us about the state change asynchronously. The reason for this change is that otherwise all functions that access the entry group depend on the out-of-date state for their validity checks, which is obviously a bad idea. git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1269 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c index e43a44f..ea9b676 100644 --- a/avahi-client/entrygroup.c +++ b/avahi-client/entrygroup.c @@ -249,21 +249,31 @@ int avahi_entry_group_free(AvahiEntryGroup *group) { } int avahi_entry_group_commit(AvahiEntryGroup *group) { + int ret; assert(group); if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); - return entry_group_simple_method_call(group, "Commit"); + if ((ret = entry_group_simple_method_call(group, "Commit")) < 0) + return ret; + + avahi_entry_group_set_state(group, AVAHI_ENTRY_GROUP_REGISTERING); + return 0; } int avahi_entry_group_reset(AvahiEntryGroup *group) { + int ret; assert(group); if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); - return entry_group_simple_method_call(group, "Reset"); + if ((ret = entry_group_simple_method_call(group, "Reset")) < 0) + return ret; + + avahi_entry_group_set_state(group, AVAHI_ENTRY_GROUP_UNCOMMITED); + return 0; } int avahi_entry_group_get_state (AvahiEntryGroup *group) {