summaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/low-can-subscription.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-08-12 17:58:50 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2019-08-13 12:15:21 +0000
commit08a4337bf62b7b0671c75f8b3d34a803384ec364 (patch)
tree3cfa00b03143b646cf3e7761d57c075a68d94843 /low-can-binding/binding/low-can-subscription.cpp
parentf846986ed6159030e5ddb3827d9f1c5e2a82742f (diff)
Fix: only one subscription could be made
Only one subscription could be made and then only one subscriber could receive associated events. As the relationship between events and subscriber is not 1-1 but 1-N, so this was the mistake. Now 1 event is created for N subscriber where before there was 1 event for 1 subscriber and subsequent subscribers could not receive same events than the ones already subscribed. Bug-AGL: SPEC-2726 Change-Id: I4e4a80ac9f9b6b4c6b006108ee55f355a7c1e377 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/binding/low-can-subscription.cpp')
-rw-r--r--low-can-binding/binding/low-can-subscription.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp
index bb488887..736e034a 100644
--- a/low-can-binding/binding/low-can-subscription.cpp
+++ b/low-can-binding/binding/low-can-subscription.cpp
@@ -95,8 +95,13 @@ int low_can_subscription_t::set_event()
*/
int low_can_subscription_t::subscribe(afb_req_t request)
{
- if(set_event() < 0)
- return -1;
+ if(! afb_event_is_valid(event_))
+ {
+ if(set_event() < 0)
+ {
+ return -1;
+ }
+ }
return afb_req_subscribe(request, event_);
}