Skip to content

Commit

Permalink
libostree: Get and set OstreeAsyncProgress:status atomically
Browse files Browse the repository at this point in the history
Use the new well-known `status` key for OstreeAsyncProgress to get and
set the status atomically with other keys in an OstreeAsyncProgress
instance.

Signed-off-by: Philip Withnall <[email protected]>

Closes: #819
Approved by: cgwalters
  • Loading branch information
pwithnall authored and rh-atomic-bot committed Apr 29, 2017
1 parent ce83abb commit cbe3989
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/libostree/ostree-repo-pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ update_progress (gpointer user_data)
/* We fetch metadata before content. These allow us to report metadata fetch progress specifically. */
"outstanding-metadata-fetches", "u", pull_data->n_outstanding_metadata_fetches,
"metadata-fetched", "u", pull_data->n_fetched_metadata,
/* Overall status. */
"status", "s", "",
NULL);

ostree_async_progress_set_status (pull_data->progress, NULL);

if (pull_data->dry_run)
pull_data->dry_run_emitted_progress = TRUE;

Expand Down
5 changes: 2 additions & 3 deletions src/libostree/ostree-repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -3748,8 +3748,6 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress

buf = g_string_new ("");

status = ostree_async_progress_get_status (progress);

ostree_async_progress_get (progress,
"outstanding-fetches", "u", &outstanding_fetches,
"outstanding-metadata-fetches", "u", &outstanding_metadata_fetches,
Expand All @@ -3760,9 +3758,10 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
"total-delta-parts", "u", &total_delta_parts,
"fetched-delta-fallbacks", "u", &fetched_delta_part_fallbacks,
"total-delta-fallbacks", "u", &total_delta_part_fallbacks,
"status", "s", &status,
NULL);

if (status)
if (*status != '\0')
{
g_string_append (buf, status);
}
Expand Down

0 comments on commit cbe3989

Please sign in to comment.