aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--low-can-binding/binding/low-can-cb.cpp3
-rw-r--r--low-can-binding/binding/low-can-subscription.cpp9
2 files changed, 8 insertions, 4 deletions
diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp
index 5fdd961e..2b630845 100644
--- a/low-can-binding/binding/low-can-cb.cpp
+++ b/low-can-binding/binding/low-can-cb.cpp
@@ -151,8 +151,7 @@ static int subscribe_unsubscribe_signal(afb_req_t request,
}
// Event doesn't exist , so let's create it
- if (! subscription_exists &&
- (ret = can_subscription->subscribe(request)) < 0)
+ if ((ret = can_subscription->subscribe(request)) < 0)
return ret;
if(! subscription_exists)
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_);
}