summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-08-24 21:02:46 +0000
committerLennart Poettering <lennart@poettering.net>2006-08-24 21:02:46 +0000
commit8a0e03b4fc8687a91b9a6800145e613c3a009247 (patch)
tree127daf414561aa1b678c994cc9474af6d81e9fdf
parente521a9a2fad8314d5e7d5bbde47b2c852a1426a7 (diff)
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
-rw-r--r--avahi-client/entrygroup.c14
1 files changed, 12 insertions, 2 deletions
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) {