From 9ea6dcf3615bbce36e1f90f85eb47aba25fecdba Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Thu, 20 Nov 2014 16:41:41 +0000 Subject: attempting to get child watches to happen recursivly, so that children of children are also watched --- ZKTest/Debug/ZKTest | Bin 91773 -> 91991 bytes ZKTest/Debug/src/ZKTest.o | Bin 180024 -> 181256 bytes ZKTest/src/ZKTest.cpp | 23 +++++++++++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ZKTest/Debug/ZKTest b/ZKTest/Debug/ZKTest index 21cf97d..1abce8b 100755 Binary files a/ZKTest/Debug/ZKTest and b/ZKTest/Debug/ZKTest differ diff --git a/ZKTest/Debug/src/ZKTest.o b/ZKTest/Debug/src/ZKTest.o index f2f42a9..f4c4187 100644 Binary files a/ZKTest/Debug/src/ZKTest.o and b/ZKTest/Debug/src/ZKTest.o differ diff --git a/ZKTest/src/ZKTest.cpp b/ZKTest/src/ZKTest.cpp index 3518271..05691ba 100644 --- a/ZKTest/src/ZKTest.cpp +++ b/ZKTest/src/ZKTest.cpp @@ -18,6 +18,7 @@ using namespace std; static zhandle_t *zk; static const clientid_t *session_id; +struct String_vector *list_of_children; int timeout = 3000; int responseCode = 0; @@ -46,7 +47,6 @@ int main(int argc, char **argv) } std::cout << "authentication step done" << std::endl; - //responseCode = zoo_create(zk, "/test","my_data",7, &ZOO_OPEN_ACL_UNSAFE, ZOO_EPHEMERAL, NULL, NULL); while (zk) { @@ -117,14 +117,25 @@ void watcher(zhandle_t *zzh, int type, int state, const char *path, { cout << "node delete detected" << std::endl; } - else if (state == ZOO_CHANGED_EVENT) - { - responseCode = zoo_exists(zk, path, true, NULL); - cout << "change detected" << std::endl; - } else if (state == ZOO_CHILD_EVENT) { zoo_get_children(zk, path, true, NULL); cout << "child change detected" << std::endl; } + else if (state == ZOO_CHANGED_EVENT) + { + responseCode = zoo_exists(zk, path, true, NULL); + std::cout<<"£"<count; i++) + { + std::cout<count<data[i] , true, NULL); + } + } + cout << "change detected" << std::endl; + } } -- cgit v1.2.1