Commit 38fe8e11 authored by Christian Hergert's avatar Christian Hergert
Browse files

flatpak: do network query immediately

We can ignore the rest of the work if the network is down and
we won't be able to query the peer anyway. It also ensures we
don't clear the force-update bit.
parent 7cb76c51
......@@ -51,7 +51,6 @@ gbp_flatpak_download_stage_query (IdeBuildStage *stage,
{
GbpFlatpakDownloadStage *self = (GbpFlatpakDownloadStage *)stage;
IdeConfiguration *config;
GNetworkMonitor *monitor;
g_autofree gchar *staging_dir = NULL;
g_autofree gchar *manifest_path = NULL;
g_autofree gchar *stop_at_option = NULL;
......@@ -62,6 +61,17 @@ gbp_flatpak_download_stage_query (IdeBuildStage *stage,
g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
/* Ignore downloads if there is no connection */
if (!g_network_monitor_get_network_available (g_network_monitor_get_default ()))
{
ide_build_stage_log (stage,
IDE_BUILD_LOG_STDOUT,
_("Network is not available, skipping downloads"),
-1);
ide_build_stage_set_completed (stage, TRUE);
return;
}
config = ide_build_pipeline_get_configuration (pipeline);
if (!GBP_IS_FLATPAK_CONFIGURATION (config))
{
......@@ -107,17 +117,6 @@ gbp_flatpak_download_stage_query (IdeBuildStage *stage,
self->invalid = FALSE;
self->force_update = FALSE;
}
/* Ignore downloads if there is no connection */
monitor = g_network_monitor_get_default ();
if (!g_network_monitor_get_network_available (monitor))
{
ide_build_stage_log (stage,
IDE_BUILD_LOG_STDOUT,
_("Network is not available, skipping downloads"),
-1);
ide_build_stage_set_completed (stage, TRUE);
}
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment