-
Notifications
You must be signed in to change notification settings - Fork 61
Conversation
It did not match the format of empty targets that the server actually sends us. Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
@@ -628,7 +628,7 @@ std::pair<bool, Uptane::Target> SotaUptaneClient::downloadImage(Uptane::Target t | |||
} | |||
} | |||
if (!success) { | |||
LOG_ERROR << "Download unsuccessful after " << tries << " attempts."; | |||
LOG_ERROR << "Download unsuccessful after " << tries - 1 << " attempts."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about for (; tries < max_tries; tries++)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Codecov Report
@@ Coverage Diff @@
## master #1180 +/- ##
==========================================
- Coverage 78.01% 77.97% -0.04%
==========================================
Files 170 170
Lines 10006 10013 +7
==========================================
+ Hits 7806 7808 +2
- Misses 2200 2205 +5
Continue to review full report at Codecov.
|
targets_unsigned["expires"] = expiration_time_; | ||
targets_unsigned["version"] = (targets_current["signed"]["version"].asUInt()) + 1; | ||
targets_unsigned["targets"] = Json::objectValue; | ||
if (repo_type_ == Uptane::RepositoryType::Director() && correlation_id_ != "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a fix for the super bug ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The super bug? The fix here is just that the generated metadata was incorrect. It had the wrong meaning of "empty".
Turns out math is hard. Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
success = package_manager_->fetchTarget(target, *uptane_fetcher, keys, prog_cb, token); | ||
if (success) { | ||
break; | ||
} else if (tries < max_tries) { | ||
} else if (tries < max_tries - 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we won't sleep in the last iteration (i = 2)? My guess would be that we don't need an else if
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Why bother sleeping if we've tried three times and failed? No need to sleep before moving on to the next thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Somehow I always get confused by this simple loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me too. This is at least the third time we've tried to get it right despite it being so deceptively simple.
Things found while doing other things.