aboutsummaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal-composer.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-12-11 13:36:17 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:49 +0100
commit1b4bbe3b4f048754fe90e93546126f1d161d8037 (patch)
tree539e372998e876e7f90fd9ef4ee0e3ff81189112 /signal-composer-binding/signal-composer.cpp
parent9a4ba373acf7b7feac6d980506bcdad20b96bdb6 (diff)
Avoid create duplicate source entries.
Change-Id: If50a439634382fa6d1c856b5c3fb29db4eb93a31 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/signal-composer.cpp')
-rw-r--r--signal-composer-binding/signal-composer.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/signal-composer-binding/signal-composer.cpp b/signal-composer-binding/signal-composer.cpp
index 4a0346c..0fb3f3d 100644
--- a/signal-composer-binding/signal-composer.cpp
+++ b/signal-composer-binding/signal-composer.cpp
@@ -300,6 +300,16 @@ int Composer::loadOneSourceAPI(json_object* sourceJ)
return err;
}
+ // Checking duplicate entry and ignore if so
+ for(auto& src: sourcesListV_)
+ {
+ if(*src == uid)
+ {
+ json_object_put(sourceJ);
+ return 0;
+ }
+ }
+
if(ctlConfig_ && ctlConfig_->requireJ)
{
const char* requireS = json_object_to_json_string(ctlConfig_->requireJ);
@@ -322,7 +332,7 @@ int Composer::loadOneSourceAPI(json_object* sourceJ)
onReceivedCtl = onReceivedJ ? convert2Action("onReceived", onReceivedJ) : nullptr;
- sourcesListV_.push_back(std::make_shared<SourceAPI>(api, info, initCtl, getSignalsCtl, onReceivedCtl, retention));
+ sourcesListV_.push_back(std::make_shared<SourceAPI>(uid, api, info, initCtl, getSignalsCtl, onReceivedCtl, retention));
return err;
}