summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-16 19:23:55 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 19:23:55 +0100
commit11896f4d36c4c5c81cf86e8356eb5b3777272f4b (patch)
treef3ead7c9b3b74c990265067beade18ff5d6f65a7 /src
parent24049db55457ddc3f11437ae75d7f5737a52ec5b (diff)
Wrong error handling when fire diagnostic request.
As returned code was negative value the sd_event_source stopped considering that was an error. If statement was to check that sd_event_set_enabled was ok, so unref and return wasn't at the right location... Change-Id: I91cc943c20af80a31b4f66f5714ccef93c0fdbd2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/diagnostic/diagnostic-manager.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/diagnostic/diagnostic-manager.cpp b/src/diagnostic/diagnostic-manager.cpp
index 4fc34b18..5a8d23b4 100644
--- a/src/diagnostic/diagnostic-manager.cpp
+++ b/src/diagnostic/diagnostic-manager.cpp
@@ -461,16 +461,14 @@ int diagnostic_manager_t::send_request(sd_event_source *s, uint64_t usec, void *
DEBUG(binder_interface, "send_request: Event loop state: %d. usec: %ld", sd_event_get_state(afb_daemon_get_event_loop(binder_interface->daemon)), usec);
if(sd_event_source_set_time(s, usec+1000000) >= 0)
if(sd_event_source_set_enabled(s, SD_EVENT_ON) >= 0)
- {
- sd_event_source_unref(s);
- return -2;
- }
- return 1;
+ return 0;
+ sd_event_source_unref(s);
+ return -1;
}
}
sd_event_source_unref(s);
ERROR(binder_interface, "send_request: Something goes wrong when submitting a new request to the CAN bus");
- return -3;
+ return -2;
}
/// @brief Will decode the diagnostic response and build the final openxc_VehicleMessage to return.