return http;
}
+/**
+ * grits_http_abort:
+ * @http: the #GritsHttp to abort
+ *
+ * Cancels any pending requests and prevents new requests.
+ */
+void grits_http_abort(GritsHttp *http)
+{
+ g_debug("GritsHttp: abort - %s", http->prefix);
+ http->aborted = TRUE;
+ soup_session_abort(http->soup);
+}
+
/**
* grits_http_free:
* @http: the #GritsHttp to free
void grits_http_free(GritsHttp *http)
{
g_debug("GritsHttp: free - %s", http->prefix);
- soup_session_abort(http->soup);
g_object_unref(http->soup);
g_free(http->prefix);
g_free(http);
GritsCacheType mode, GritsChunkCallback callback, gpointer user_data)
{
g_debug("GritsHttp: fetch - %s mode=%d", local, mode);
+ if (http->aborted) {
+ g_debug("GritsPluginSat: _load_tile_thread - aborted");
+ return NULL;
+ }
gchar *path = _get_cache_path(http, local);
/* Unlink the file if we're refreshing it */
const gchar *file;
gchar *path = _get_cache_path(http, cache);
GDir *dir = g_dir_open(path, 0, NULL);
- while ((file = g_dir_read_name(dir)))
+ while (dir && (file = g_dir_read_name(dir)))
if (g_regex_match(filter_re, file, 0, NULL))
files = g_list_prepend(files, g_strdup(file));
g_free(path);
- g_dir_close(dir);
+ if (dir)
+ g_dir_close(dir);
}
/* Add online files if online */