"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "common/flatpak-dir.c" between
flatpak-1.8.2.tar.xz and flatpak-1.8.3.tar.xz

About: Flatpak is a Linux application sandboxing and distribution framework.

flatpak-dir.c  (flatpak-1.8.2.tar.xz):flatpak-dir.c  (flatpak-1.8.3.tar.xz)
skipping to change at line 987 skipping to change at line 987
_("Couldn't find latest checksum for ref %s in rem ote %s"), _("Couldn't find latest checksum for ref %s in rem ote %s"),
ref, self->remote_name); ref, self->remote_name);
return NULL; return NULL;
} }
} }
else else
commit = g_strdup (opt_commit); commit = g_strdup (opt_commit);
/* First try local availability */ /* First try local availability */
if (ostree_repo_load_commit (dir->repo, commit, &commit_data, NULL, NULL)) if (ostree_repo_load_commit (dir->repo, commit, &commit_data, NULL, NULL))
return g_steal_pointer (&commit_data); goto out;
for (int i = 0; i < self->sideload_repos->len; i++) for (int i = 0; i < self->sideload_repos->len; i++)
{ {
FlatpakSideloadState *ss = g_ptr_array_index (self->sideload_repos, i); FlatpakSideloadState *ss = g_ptr_array_index (self->sideload_repos, i);
if (ostree_repo_load_commit (ss->repo, commit, &commit_data, NULL, NULL)) if (ostree_repo_load_commit (ss->repo, commit, &commit_data, NULL, NULL))
return g_steal_pointer (&commit_data); goto out;
} }
if (flatpak_dir_get_remote_oci (dir, self->remote_name)) if (flatpak_dir_get_remote_oci (dir, self->remote_name))
commit_data = flatpak_remote_state_fetch_commit_object_oci (self, dir, ref, commit, token, commit_data = flatpak_remote_state_fetch_commit_object_oci (self, dir, ref, commit, token,
cancellable, err or); cancellable, err or);
else else
commit_data = flatpak_remote_state_fetch_commit_object (self, dir, ref, comm it, token, commit_data = flatpak_remote_state_fetch_commit_object (self, dir, ref, comm it, token,
cancellable, error); cancellable, error);
out:
if (out_commit) if (out_commit)
*out_commit = g_steal_pointer (&commit); *out_commit = g_steal_pointer (&commit);
return g_steal_pointer (&commit_data); return g_steal_pointer (&commit_data);
} }
gboolean gboolean
flatpak_remote_state_lookup_sparse_cache (FlatpakRemoteState *self, flatpak_remote_state_lookup_sparse_cache (FlatpakRemoteState *self,
const char *ref, const char *ref,
VarMetadataRef *out_metadata, VarMetadataRef *out_metadata,
skipping to change at line 10568 skipping to change at line 10569
G_LOCK (cache); G_LOCK (cache);
if (self->summary_cache == NULL) if (self->summary_cache == NULL)
self->summary_cache = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) cached_summary_free); self->summary_cache = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) cached_summary_free);
summary = g_hash_table_lookup (self->summary_cache, name); summary = g_hash_table_lookup (self->summary_cache, name);
if (summary) if (summary)
{ {
guint64 now = g_get_monotonic_time (); guint64 now = g_get_monotonic_time ();
if ((now - summary->time) < (1000 * 1000 * (SUMMARY_CACHE_TIMEOUT_SEC)) && if ((now - summary->time) / G_USEC_PER_SEC < SUMMARY_CACHE_TIMEOUT_SEC &&
strcmp (url, summary->url) == 0) strcmp (url, summary->url) == 0)
{ {
/* g_debug ("Using cached summary for remote %s", name); */ /* g_debug ("Using cached summary for remote %s", name); */
*bytes_out = g_bytes_ref (summary->bytes); *bytes_out = g_bytes_ref (summary->bytes);
if (bytes_sig_out) if (bytes_sig_out)
{ {
if (summary->bytes_sig) if (summary->bytes_sig)
*bytes_sig_out = g_bytes_ref (summary->bytes_sig); *bytes_sig_out = g_bytes_ref (summary->bytes_sig);
else else
*bytes_sig_out = NULL; *bytes_sig_out = NULL;
} }
res = TRUE; res = TRUE;
/* Bump the cache expiry time */
summary->time = now;
}
else
{
/* Timed out or URL has changed; remove the entry */
g_hash_table_remove (self->summary_cache, name);
res = FALSE;
} }
} }
G_UNLOCK (cache); G_UNLOCK (cache);
return res; return res;
} }
static void static void
flatpak_dir_cache_summary (FlatpakDir *self, flatpak_dir_cache_summary (FlatpakDir *self,
 End of changes. 5 change blocks. 
3 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)