summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/diagnostic/active-diagnostic-request.cpp6
-rw-r--r--src/diagnostic/diagnostic-manager.cpp19
2 files changed, 16 insertions, 9 deletions
diff --git a/src/diagnostic/active-diagnostic-request.cpp b/src/diagnostic/active-diagnostic-request.cpp
index ad6e59e4..8b6f0547 100644
--- a/src/diagnostic/active-diagnostic-request.cpp
+++ b/src/diagnostic/active-diagnostic-request.cpp
@@ -156,12 +156,12 @@ bool active_diagnostic_request_t::is_diagnostic_signal(const std::string& name)
/// @brief Check is the request should be sent or not
///
/// @return true if the request is not running or recurring nor completed,
-/// or it's recurring, its clock elapsed, request was successful
+/// or it's recurring, its clock elapsed
/// so it's time to send another one.
bool active_diagnostic_request_t::should_send()
{
- return !in_flight_ || (!recurring_ && !request_completed()) ||
- (recurring_ && frequency_clock_.elapsed(true) && request_completed() && handle_->success);
+ return !in_flight_ && ( (!recurring_ && !request_completed()) ||
+ (recurring_ && frequency_clock_.elapsed(true)) );
}
/// @brief check if the timeout clock has elapsed
diff --git a/src/diagnostic/diagnostic-manager.cpp b/src/diagnostic/diagnostic-manager.cpp
index 89999f4f..5834c35d 100644
--- a/src/diagnostic/diagnostic-manager.cpp
+++ b/src/diagnostic/diagnostic-manager.cpp
@@ -369,18 +369,24 @@ bool diagnostic_manager_t::add_recurring_request(DiagnosticRequest* request, con
wait_for_multiple_responses, decoder, callback, frequencyHz);
entry->set_handle(shims_, request);
- char request_string[128] = {0};
- diagnostic_request_to_string(&entry->get_handle()->request, request_string,
- sizeof(request_string));
+ //start_diagnostic_request(&shims_, entry->get_handle());
+ //char request_string[128] = {0};
+ //diagnostic_request_to_string(&entry->get_handle()->request, request_string,
+ // sizeof(request_string));
uint64_t usec;
sd_event_now(afb_daemon_get_event_loop(binder_interface->daemon), CLOCK_BOOTTIME, &usec);
+ if(recurring_requests_.size() > 0)
+ {
+ DEBUG(binder_interface, "add_recurring_request: Added 100ms to usec to stagger sending requests");
+ usec += 100000;
+ }
- DEBUG(binder_interface, "add_recurring_request: Added recurring diagnostic request (freq: %f) on bus %s: (%s) at %ld",
+ DEBUG(binder_interface, "add_recurring_request: Added recurring diagnostic request (freq: %f) on bus %s at %ld. Event loop state: %d",
frequencyHz,
bus_.c_str(),
- request_string,
- usec);
+ usec,
+ sd_event_get_state(afb_daemon_get_event_loop(binder_interface->daemon)));
if(sd_event_add_time(afb_daemon_get_event_loop(binder_interface->daemon), &source,
CLOCK_BOOTTIME, usec, TIMERFD_ACCURACY, send_request, request) < 0)
@@ -468,6 +474,7 @@ int diagnostic_manager_t::send_request(sd_event_source *s, uint64_t usec, void *
DiagnosticRequest* request = (DiagnosticRequest*)userdata;
active_diagnostic_request_t* adr = dm.find_recurring_request(request);
+ dm.cleanup_active_requests(false);
if(adr != nullptr && adr->get_can_bus_dev() == dm.get_can_bus_dev() && adr->should_send() &&
dm.clear_to_send(adr))
{