summaryrefslogtreecommitdiffstats
path: root/src/diagnostic/active-diagnostic-request.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-22 16:40:15 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-23 14:42:43 +0100
commit156b8f9c39a81cbbad7c32dbebdf321787611779 (patch)
treef089611edaeaf62b75310d18db7464c06ef14af5 /src/diagnostic/active-diagnostic-request.cpp
parentfe8235f257a009c911c63238885a47e0c3633293 (diff)
Send diag request only if not other one with some id running
Fix: elapsed function return that do not compute elapsed_time at first time Fix: reworked should_send() to get it work with our scheduling workflow Reschedule trying to send request if recurring even it is in flight. Change-Id: Idce54cb9bf62616c891a8a25a6c478f931350bc7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/diagnostic/active-diagnostic-request.cpp')
-rw-r--r--src/diagnostic/active-diagnostic-request.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/diagnostic/active-diagnostic-request.cpp b/src/diagnostic/active-diagnostic-request.cpp
index a9c21c63..ad6e59e4 100644
--- a/src/diagnostic/active-diagnostic-request.cpp
+++ b/src/diagnostic/active-diagnostic-request.cpp
@@ -155,14 +155,13 @@ 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 isn't already running and not
-/// recurring nor completed, or it is recurring its clock elapsed so it's
-/// time to send another one.
+/// @return true if the request is not running or recurring nor completed,
+/// or it's recurring, its clock elapsed, request was successful
+/// so it's time to send another one.
bool active_diagnostic_request_t::should_send()
{
- return !get_in_flight() && (
- (!get_recurring() && !request_completed()) ||
- (get_recurring() && get_frequency_clock().elapsed(true)));
+ return !in_flight_ || (!recurring_ && !request_completed()) ||
+ (recurring_ && frequency_clock_.elapsed(true) && request_completed() && handle_->success);
}
/// @brief check if the timeout clock has elapsed