pull: Go back to using one main context
xdg-app was hanging for me with v2015.8, but worked with v2015.7. I narrowed things down to the GMainLoop/context commit, in which we started pushing a temporary main context for synchronous requests internally. That's never really going to work with libsoup - there needs to be a single main context which works on the socket. Furthermore, clients couldn't get progress messages that way. For *other* internal uses where we added APIs that talk to the remote repo, we cleanly push a temporary main context. (Note that I kind of snuck in a change here around the GError handling in pulls that isn't strictly related but came up in testing)
This commit is contained in:
1 parent
ef56321354
commit
84fe2ffb2b
4 files changed
+32
-10
No files matched your search
@@ -96,6 +96,7 @@ typedef struct {
|
||||
guint64 previous_bytes_sec;
|
||||
guint64 previous_total_downloaded;
|
||||
|
||||
GError *cached_async_error;
|
||||
GError **async_error;
|
||||
gboolean caught_error;
|
||||
|
||||
@@ -1697,7 +1698,10 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
pull_data->is_mirror = (flags & OSTREE_REPO_PULL_FLAGS_MIRROR) > 0;
|
||||
pull_data->is_commit_only = (flags & OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY) > 0;
|
||||
|
||||
pull_data->async_error = error;
|
||||
if (error)
|
||||
pull_data->async_error = &pull_data->cached_async_error;
|
||||
else
|
||||
pull_data->async_error = NULL;
|
||||
pull_data->main_context = g_main_context_ref_thread_default ();
|
||||
pull_data->flags = flags;
|
||||
|
||||
@@ -2227,6 +2231,15 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
/* This is pretty ugly - we have two error locations, because we
|
||||
* have a mix of synchronous and async code. Mixing them gets messy
|
||||
* as we need to avoid overwriting errors.
|
||||
*/
|
||||
if (pull_data->cached_async_error && error && !*error)
|
||||
g_propagate_error (error, pull_data->cached_async_error);
|
||||
else
|
||||
g_clear_error (&pull_data->cached_async_error);
|
||||
|
||||
ostree_repo_abort_transaction (pull_data->repo, cancellable, NULL);
|
||||
g_main_context_unref (pull_data->main_context);
|
||||
if (update_timeout)
|
||||
|
||||
Reference in new issue
Block a user