From 7a014d3b795401a2a728398dea8b06dcb931c119 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 22 Mar 2017 17:10:30 +0000 Subject: Max in flight requests set to 8 Change-Id: If2acf83a0f01741c90cab15e10188b2aeffd88b3 --- src/diagnostic/diagnostic-manager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/diagnostic/diagnostic-manager.cpp') diff --git a/src/diagnostic/diagnostic-manager.cpp b/src/diagnostic/diagnostic-manager.cpp index 151c78e..fcfd199 100644 --- a/src/diagnostic/diagnostic-manager.cpp +++ b/src/diagnostic/diagnostic-manager.cpp @@ -25,6 +25,8 @@ #define MAX_RECURRING_DIAGNOSTIC_FREQUENCY_HZ 10 #define MAX_SIMULTANEOUS_DIAG_REQUESTS 50 +// There are only 8 slots of in flight diagnostic requests +#define MAX_SIMULTANEOUS_IN_FLIGHT_REQUESTS 8 #define TIMERFD_ACCURACY 0 #define MICRO 1000000 @@ -412,17 +414,25 @@ bool diagnostic_manager_t::conflicting(active_diagnostic_request_t* request, act /// @brief Returns true if there are no other active requests to the same arbitration ID. bool diagnostic_manager_t::clear_to_send(active_diagnostic_request_t* request) const { + int total_in_flight = 0; for ( auto entry : non_recurring_requests_) { if(conflicting(request, entry)) return false; + if(entry->get_in_flight()) + total_in_flight++; } for ( auto entry : recurring_requests_) { if(conflicting(request, entry)) return false; + if(entry->get_in_flight()) + total_in_flight++; } + + if(total_in_flight > MAX_SIMULTANEOUS_IN_FLIGHT_REQUESTS) + return false; return true; } -- cgit 1.2.3-korg