aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--signal-composer-binding/signal-composer-binding.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/signal-composer-binding/signal-composer-binding.cpp b/signal-composer-binding/signal-composer-binding.cpp
index 310cb40..7d3391b 100644
--- a/signal-composer-binding/signal-composer-binding.cpp
+++ b/signal-composer-binding/signal-composer-binding.cpp
@@ -83,15 +83,22 @@ static int one_subscribe_unsubscribe(struct afb_req request,
int err = 0;
std::vector<std::shared_ptr<Signal>> signals = Composer::instance().searchSignals(event);
- if(subscribe)
+ if(signals.size() == 0 && subscribe)
{
- cContext->appendSignals(signals);
- err = cContext->makeSubscription(request);
+ err--;
}
else
{
- cContext->subtractSignals(signals);
- err = cContext->makeUnsubscription(request);
+ if(subscribe)
+ {
+ cContext->appendSignals(signals);
+ err = cContext->makeSubscription(request);
+ }
+ else
+ {
+ cContext->subtractSignals(signals);
+ err = cContext->makeUnsubscription(request);
+ }
}
return err;