From 891dc7bedf926e200cda171d7f4c0ca59f276736 Mon Sep 17 00:00:00 2001 From: Tao He Date: Wed, 28 Jul 2021 17:57:33 +0800 Subject: [PATCH] Revisit docs about how could we "reconnect" when failure. See also: https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/issues/73#issuecomment-888150328 Signed-off-by: Tao He --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a697257..fd8d1f0 100644 --- a/README.md +++ b/README.md @@ -507,11 +507,12 @@ void wait_for_connection(Client &client) { void initialize_watcher(const std::string &endpoints, const std::string &prefix, std::function callback, - std::unique_ptr &watcher) { + std::shared_ptr &watcher) { Client client(endpoints); wait_for_connection(client); watcher->reset(new etcd::Watcher(client, prefix, callback)); - watcher->Wait([endpoints, prefix, callback, &watcher](bool cancelled) { + watcher->Wait([endpoints, prefix, callback, + watcher_ref /* keep the shared_ptr alive */, &watcher](bool cancelled) { if (cancelled) { return; }