From: Romain Forlot Date: Wed, 26 Apr 2017 13:46:49 +0000 (+0200) Subject: Fix: correctly count (un)subscribed signals. X-Git-Tag: 5.0.2~297 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=55a206228d575484e97a231c95a9944eb27a2601;p=apps%2Fagl-service-can-low-level.git Fix: correctly count (un)subscribed signals. Can't be 0 subscription so success if greater than 0 Change-Id: Ie4395dbabe4ed85fe939ebdfa9de87e210fa55bc Signed-off-by: Romain Forlot --- diff --git a/CAN-binder/low-can-binding/low-can-binding.cpp b/CAN-binder/low-can-binding/low-can-binding.cpp index e6af92cc..484bb5c7 100644 --- a/CAN-binder/low-can-binding/low-can-binding.cpp +++ b/CAN-binder/low-can-binding/low-can-binding.cpp @@ -173,12 +173,12 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, for(const auto& sig: signals.can_signals) { if(conf.get_can_bus_manager().create_rx_filter(*sig) <= 0 && - subscribe_unsubscribe_signal(request, subscribe, sig->get_name()) <= 0) + subscribe_unsubscribe_signal(request, subscribe, sig->get_name()) <=0 ) { return -1; - rets++; - DEBUG(binder_interface, "%s: signal: %s subscribed", __FUNCTION__, sig->get_name().c_str()); } + rets++; + DEBUG(binder_interface, "%s: signal: %s subscribed", __FUNCTION__, sig->get_name().c_str()); } return rets; } @@ -236,7 +236,7 @@ extern "C" } NOTICE(binder_interface, "%s: Subscribed/unsubscribe correctly to %d/%d signal(s).", __FUNCTION__, ok, total); - if (ok) + if (ok > 0) afb_req_success(request, NULL, NULL); else afb_req_fail(request, "error", NULL);