summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/diagnostic/diagnostic-manager.cpp10
1 files changed, 10 insertions, 0 deletions
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;
}