trivial: Do not warn about the same missing remote more than once

Removes 4 instances of 'ignoring unfound remote fwupd' at startup.
This commit is contained in:
Richard Hughes 2020-10-01 13:47:14 +01:00
parent 61a2dbad13
commit f4052b53f4

View File

@ -34,6 +34,7 @@ struct _FuRemoteList
GObject parent_instance;
GPtrArray *array; /* (element-type FwupdRemote) */
GPtrArray *monitors; /* (element-type GFileMonitor) */
GHashTable *hash_unfound; /* utf8 : NULL */
XbSilo *silo;
};
@ -296,6 +297,7 @@ static guint
fu_remote_list_depsolve_with_direction (FuRemoteList *self, gint inc)
{
guint cnt = 0;
for (guint i = 0; i < self->array->len; i++) {
FwupdRemote *remote = g_ptr_array_index (self->array, i);
gchar **order = inc < 0 ? fwupd_remote_get_order_after (remote) :
@ -310,7 +312,11 @@ fu_remote_list_depsolve_with_direction (FuRemoteList *self, gint inc)
}
remote2 = fu_remote_list_get_by_id (self, order[j]);
if (remote2 == NULL) {
if (g_hash_table_contains (self->hash_unfound, order[j]))
continue;
g_debug ("ignoring unfound remote %s", order[j]);
g_hash_table_insert (self->hash_unfound,
g_strdup (order[j]), NULL);
continue;
}
if (fwupd_remote_get_priority (remote) > fwupd_remote_get_priority (remote2))
@ -487,6 +493,7 @@ fu_remote_list_init (FuRemoteList *self)
{
self->array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
self->monitors = g_ptr_array_new_with_free_func ((GDestroyNotify) fu_remote_list_monitor_unref);
self->hash_unfound = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
}
static void
@ -497,6 +504,7 @@ fu_remote_list_finalize (GObject *obj)
g_object_unref (self->silo);
g_ptr_array_unref (self->array);
g_ptr_array_unref (self->monitors);
g_hash_table_unref (self->hash_unfound);
G_OBJECT_CLASS (fu_remote_list_parent_class)->finalize (obj);
}