summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/hs-client.cpp5
-rw-r--r--src/hs-client.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/hs-client.cpp b/src/hs-client.cpp
index 26e43bb..536ff6e 100644
--- a/src/hs-client.cpp
+++ b/src/hs-client.cpp
@@ -142,7 +142,12 @@ int HS_Client::subscribe(afb_req_t request, const char* event)
auto ip = event_list.find(std::string(event));
if(ip == event_list.end()) {
event_list[std::string(event)] = 0;
+ }
+ if(!subscription) {
ret = afb_req_subscribe(request, my_event);
+ if(ret == 0) {
+ subscription = true;
+ }
}
return ret;
}
diff --git a/src/hs-client.h b/src/hs-client.h
index 16fa39c..b06a717 100644
--- a/src/hs-client.h
+++ b/src/hs-client.h
@@ -47,6 +47,7 @@ private:
private:
std::string my_id;
afb_event_t my_event;
+ bool subscription = false;
std::unordered_map<std::string, int> event_list;
};