From 0c9699b0761824890113d14aad28cf651de66bac Mon Sep 17 00:00:00 2001 From: Alexis Date: Fri, 26 Oct 2018 10:27:15 +0200 Subject: [PATCH] fix: check before set is host registered --- src/modules/sni/snw.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/sni/snw.cpp b/src/modules/sni/snw.cpp index 8a348ee..577ca27 100644 --- a/src/modules/sni/snw.cpp +++ b/src/modules/sni/snw.cpp @@ -65,8 +65,8 @@ gboolean Watcher::handleRegisterHost(Watcher* obj, } watch = gfWatchNew(GF_WATCH_TYPE_HOST, service, bus_name, object_path, obj); obj->hosts_ = g_slist_prepend(obj->hosts_, watch); - sn_watcher_set_is_host_registered(obj->watcher_, TRUE); - if (g_slist_length(obj->hosts_)) { + if (!sn_watcher_get_is_host_registered(obj->watcher_)) { + sn_watcher_set_is_host_registered(obj->watcher_, TRUE); sn_watcher_emit_host_registered(obj->watcher_); } sn_watcher_complete_register_host(obj->watcher_, invocation);