From: Romain Forlot Date: Wed, 22 Mar 2017 17:10:30 +0000 (+0000) Subject: Max in flight requests set to 8 X-Git-Tag: 5.0.2~368 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;ds=sidebyside;h=7a014d3b795401a2a728398dea8b06dcb931c119;p=apps%2Fagl-service-can-low-level.git Max in flight requests set to 8 Change-Id: If2acf83a0f01741c90cab15e10188b2aeffd88b3 --- diff --git a/src/diagnostic/diagnostic-manager.cpp b/src/diagnostic/diagnostic-manager.cpp index 151c78eb..fcfd1994 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; }