X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=CAN-binder%2Flow-can-binding%2Fbinding%2Flow-can-cb.cpp;h=bc94eedf8145b8ca17a3be167a76ccb04b9eb4d8;hb=995fc3b8b8e51f0adfa2dac06286ede84f05a43a;hp=5a877af57bff5084de11ef2bb94c47d2039fb868;hpb=cb3d8b10b7c397184b70791c000582510215780c;p=apps%2Fagl-service-can-low-level.git diff --git a/CAN-binder/low-can-binding/binding/low-can-cb.cpp b/CAN-binder/low-can-binding/binding/low-can-cb.cpp index 5a877af5..bc94eedf 100644 --- a/CAN-binder/low-can-binding/binding/low-can-cb.cpp +++ b/CAN-binder/low-can-binding/binding/low-can-cb.cpp @@ -134,7 +134,7 @@ static int create_event_handle(std::shared_ptr& can_subs /// against the application framework using that event handle. static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe, std::shared_ptr& can_subscription, std::map >& s) { - int ret; + int ret = -1; int sub_index = can_subscription->get_index(); if (can_subscription && s.find(sub_index) != s.end()) @@ -144,6 +144,7 @@ static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe, NOTICE(binder_interface, "%s: Event isn't valid, no need to unsubscribed.", __FUNCTION__); ret = -1; } + ret = 0; } else { @@ -241,13 +242,13 @@ static int subscribe_unsubscribe_can_signals(struct afb_req request, bool subscr can_subscription = std::make_shared(low_can_subscription_t(event_filter)); if(can_subscription->create_rx_filter(sig) < 0) {return -1;} + if(add_to_event_loop(can_subscription) < 0) + {return -1;} } if(subscribe_unsubscribe_signal(request, subscribe, can_subscription, s) < 0) {return -1;} - if(add_to_event_loop(can_subscription) < 0) - {return -1;} rets++; DEBUG(binder_interface, "%s: signal: %s subscribed", __FUNCTION__, sig->get_name().c_str()); }