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:
Colin Walters committed 2015-09-01 14:39:24 -04:00
1 parent ef56321354
commit 84fe2ffb2b
4 files changed
+32 -10

No files matched your search

+7 -1
View File
@@ -1681,6 +1681,7 @@ _ostree_preload_metadata_file (OstreeRepo *self,
GError **error)
{
gboolean ret = FALSE;
if (is_metalink)
{
glnx_unref_object OstreeMetalink *metalink = NULL;
@@ -1740,12 +1741,16 @@ repo_remote_fetch_summary (OstreeRepo *self,
GError **error)
{
glnx_unref_object OstreeFetcher *fetcher = NULL;
g_autoptr(GMainContext) mainctx = NULL;
gboolean ret = FALSE;
SoupURI *base_uri = NULL;
uint i;
const char *filenames[] = {"summary", "summary.sig"};
GBytes **outputs[] = {out_summary, out_signatures};
mainctx = g_main_context_new ();
g_main_context_push_thread_default (mainctx);
fetcher = _ostree_repo_remote_new_fetcher (self, name, error);
if (fetcher == NULL)
goto out;
@@ -1787,9 +1792,10 @@ repo_remote_fetch_summary (OstreeRepo *self,
ret = TRUE;
out:
if (mainctx)
g_main_context_pop_thread_default (mainctx);
if (base_uri != NULL)
soup_uri_free (base_uri);
return ret;
}