diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-03-30 17:23:02 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-11 12:41:42 +0200 |
commit | 0ebc7362ff32637ac839b0b5adf9678277c9c332 (patch) | |
tree | 0fd259a41aaca72aa32208af9b1964bfa1ab6dfb /src/diagnostic/active-diagnostic-request.cpp | |
parent | 46d396e04947a76756739576a29c8369f8cd0c50 (diff) |
Handle simultaneous subscription to diagnostic messages.
Delay new recurring requests if there are already existing in flight and
cleanup active request to correctly set in_flight_ flag to false else new
request can't be launched as there is always an old one considered running...
Modify a little bit DEBUG message and cleanup useless code.
Change-Id: I39f865bbc6d00188d3cddd1d81437b9e3ca51269
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.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/diagnostic/active-diagnostic-request.cpp b/src/diagnostic/active-diagnostic-request.cpp index ad6e59e..8b6f054 100644 --- a/src/diagnostic/active-diagnostic-request.cpp +++ b/src/diagnostic/active-diagnostic-request.cpp @@ -156,12 +156,12 @@ 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 is not running or recurring nor completed, -/// or it's recurring, its clock elapsed, request was successful +/// or it's recurring, its clock elapsed /// so it's time to send another one. bool active_diagnostic_request_t::should_send() { - return !in_flight_ || (!recurring_ && !request_completed()) || - (recurring_ && frequency_clock_.elapsed(true) && request_completed() && handle_->success); + return !in_flight_ && ( (!recurring_ && !request_completed()) || + (recurring_ && frequency_clock_.elapsed(true)) ); } /// @brief check if the timeout clock has elapsed |