summaryrefslogtreecommitdiffstats
path: root/src/low-can-binding.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-19 02:47:26 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-19 02:47:26 +0100
commitd99b87ba4332fd0c1e51d2708e46c52bad713558 (patch)
tree3a6fdd11929f626eeb1eeade277cec7b8379fb1b /src/low-can-binding.cpp
parentf6dcb18fa4d6637b0e9a2ff7eb39f2fe98e815d6 (diff)
Fix bad handling unsupported OBD2 messages subscription.
Testing supported boolean wrong and gave a null pointer to a function that doesn't check the pointer validity. Change-Id: I49e88a68f266546dbd257b0fdade860cead1322d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/low-can-binding.cpp')
-rw-r--r--src/low-can-binding.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index d88ac996..3e870721 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -139,8 +139,6 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe,
// no matter what we want, worse case will be a fail unsubscription but at least we don't
// poll a PID for nothing.
if(found.front()->get_supported())
- subscribe = false;
- if(subscribe)
{
float frequency = found.front()->get_frequency();
configuration_t::instance().get_diagnostic_manager().add_recurring_request(
@@ -149,8 +147,11 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe,
}
else
{
+ found.front()->set_supported(false);
configuration_t::instance().get_diagnostic_manager().cleanup_request(
configuration_t::instance().get_diagnostic_manager().find_recurring_request(diag_req), true);
+ DEBUG(binder_interface, "Signal: %s isn't supported. Canceling operation.", sig.c_str());
+ return -1;
}
}