Skip to content

Commit

Permalink
mission: use correct callback for download timeout
Browse files Browse the repository at this point in the history
This changes the callback used in the case of a timeout while trying to
download the mission items. Before we used the wrong one, so never got
notified. This was not caught by the integration tests because they
generally only test the happy path given we had no hooks yet for a lossy
link where these things happen.
  • Loading branch information
julianoes committed Feb 12, 2019
1 parent 1a62225 commit 02d96ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/mission/mission_impl.cpp
Expand Up @@ -1284,15 +1284,16 @@ void MissionImpl::process_timeout()
_mission_data.mutex.lock();
if (_mission_data.retries++ > MAX_RETRIES) {
_mission_data.retries = 0;
Mission::result_callback_t result_callback = _mission_data.result_callback;
Mission::mission_items_and_result_callback_t temp_callback =
_mission_data.mission_items_and_result_callback;
_mission_data.mutex.unlock();

{
std::lock_guard<std::mutex> lock(_activity.mutex);
_activity.state = Activity::State::NONE;
}
LogWarn() << "Mission handling timed out while downloading mission.";
report_mission_result(result_callback, Mission::Result::TIMEOUT);
report_mission_items_and_result(temp_callback, Mission::Result::TIMEOUT);
} else {
_mission_data.mutex.unlock();

Expand Down

0 comments on commit 02d96ea

Please sign in to comment.