summaryrefslogtreecommitdiffstats
path: root/src/diagnostic
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-22 17:10:30 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-23 14:42:43 +0100
commit7a014d3b795401a2a728398dea8b06dcb931c119 (patch)
tree46015d535d81ff57afc25407005bbb89f5308fdb /src/diagnostic
parent94ff01afdd51a4b1b351580efc19b7c209b7f525 (diff)
Max in flight requests set to 8
Change-Id: If2acf83a0f01741c90cab15e10188b2aeffd88b3
Diffstat (limited to 'src/diagnostic')
-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;
}