Fix: don't clean recurring request except if forced
authorRomain Forlot <romain.forlot@iot.bzh>
Fri, 24 Mar 2017 17:17:42 +0000 (18:17 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Tue, 11 Apr 2017 10:41:41 +0000 (12:41 +0200)
Change-Id: I669fc1f0b078e151dfb0cbb17c3d626bb43930d2
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
src/diagnostic/diagnostic-manager.cpp

index d236160..6ab3457 100644 (file)
@@ -166,18 +166,17 @@ void diagnostic_manager_t::cancel_request(active_diagnostic_request_t* entry)
 /// @param[in] force - Force the cleaning or not ?
 void diagnostic_manager_t::cleanup_request(active_diagnostic_request_t* entry, bool force)
 {
-       if((force || (entry->get_in_flight() && entry->request_completed())) && entry != nullptr)
+       if((force || (entry != nullptr && entry->get_in_flight() && entry->request_completed())))
        {
                entry->set_in_flight(false);
 
                char request_string[128] = {0};
                diagnostic_request_to_string(&entry->get_handle()->request,
                        request_string, sizeof(request_string));
-               if(entry->get_recurring())
+               if(force && entry->get_recurring())
                {
                        find_and_erase(entry, recurring_requests_);
-                       if(force)
-                               cancel_request(entry);
+                       cancel_request(entry);
                        DEBUG(binder_interface, "cleanup_request: Cancelling completed, recurring request: %s", request_string);
                }
                else