summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-fetcher-soup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libostree/ostree-fetcher-soup.c')
-rw-r--r--src/libostree/ostree-fetcher-soup.c600
1 files changed, 239 insertions, 361 deletions
diff --git a/src/libostree/ostree-fetcher-soup.c b/src/libostree/ostree-fetcher-soup.c
index 638a950b..dbba2f00 100644
--- a/src/libostree/ostree-fetcher-soup.c
+++ b/src/libostree/ostree-fetcher-soup.c
@@ -22,35 +22,37 @@
#include "config.h"
-#include <gio/gio.h>
#include <gio/gfiledescriptorbased.h>
+#include <gio/gio.h>
#include <gio/gunixoutputstream.h>
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
-#include <libsoup/soup.h>
-#include <libsoup/soup-requester.h>
#include <libsoup/soup-request-http.h>
+#include <libsoup/soup-requester.h>
+#include <libsoup/soup.h>
#include "libglnx.h"
-#include "ostree-fetcher.h"
#include "ostree-fetcher-util.h"
+#include "ostree-fetcher.h"
#ifdef HAVE_LIBSOUP_CLIENT_CERTS
#include "ostree-tls-cert-interaction-private.h"
#endif
#include "ostree-enumtypes.h"
-#include "ostree.h"
#include "ostree-repo-private.h"
+#include "ostree.h"
#include "otutil.h"
-typedef enum {
+typedef enum
+{
OSTREE_FETCHER_STATE_PENDING,
OSTREE_FETCHER_STATE_DOWNLOADING,
OSTREE_FETCHER_STATE_COMPLETE
} OstreeFetcherState;
-typedef struct {
- int ref_count; /* atomic */
+typedef struct
+{
+ int ref_count; /* atomic */
- SoupSession *session; /* not referenced */
+ SoupSession *session; /* not referenced */
GMainContext *main_context;
volatile gint running;
GError *initialization_error; /* Any failure to load the db */
@@ -65,7 +67,7 @@ typedef struct {
GHashTable *outstanding;
/* Shared across threads; be sure to lock. */
- GHashTable *output_stream_set; /* set<GOutputStream> */
+ GHashTable *output_stream_set; /* set<GOutputStream> */
GMutex output_stream_set_lock;
/* Also protected by output_stream_set_lock. */
@@ -75,12 +77,13 @@ typedef struct {
} ThreadClosure;
-typedef struct {
- int ref_count; /* atomic */
+typedef struct
+{
+ int ref_count; /* atomic */
ThreadClosure *thread_closure;
GPtrArray *mirrorlist; /* list of base URIs */
- char *filename; /* relative name to fetch or NULL */
+ char *filename; /* relative name to fetch or NULL */
guint mirrorlist_idx;
OstreeFetcherState state;
@@ -89,14 +92,15 @@ typedef struct {
gboolean is_membuf;
OstreeFetcherRequestFlags flags;
- char *if_none_match; /* request ETag */
- guint64 if_modified_since; /* seconds since the epoch */
+ char *if_none_match; /* request ETag */
+ guint64 if_modified_since; /* seconds since the epoch */
GInputStream *request_body;
GLnxTmpfile tmpf;
GOutputStream *out_stream;
- gboolean out_not_modified; /* TRUE if the server gave a HTTP 304 Not Modified response, which we don’t propagate as an error */
- char *out_etag; /* response ETag */
- guint64 out_last_modified; /* response Last-Modified, seconds since the epoch */
+ gboolean out_not_modified; /* TRUE if the server gave a HTTP 304 Not Modified response, which we
+ don’t propagate as an error */
+ char *out_etag; /* response ETag */
+ guint64 out_last_modified; /* response Last-Modified, seconds since the epoch */
guint64 max_size;
guint64 current_size;
@@ -104,11 +108,11 @@ typedef struct {
} OstreeFetcherPendingURI;
/* Used by session_thread_idle_add() */
-typedef void (*SessionThreadFunc) (ThreadClosure *thread_closure,
- gpointer data);
+typedef void (*SessionThreadFunc) (ThreadClosure *thread_closure, gpointer data);
/* Used by session_thread_idle_add() */
-typedef struct {
+typedef struct
+{
ThreadClosure *thread_closure;
SessionThreadFunc function;
gpointer data;
@@ -125,7 +129,8 @@ struct OstreeFetcher
ThreadClosure *thread_closure;
};
-enum {
+enum
+{
PROP_0,
PROP_CONFIG_FLAGS
};
@@ -212,16 +217,13 @@ session_thread_idle_dispatch (gpointer data)
{
IdleClosure *idle_closure = data;
- idle_closure->function (idle_closure->thread_closure,
- idle_closure->data);
+ idle_closure->function (idle_closure->thread_closure, idle_closure->data);
return G_SOURCE_REMOVE;
}
static void
-session_thread_idle_add (ThreadClosure *thread_closure,
- SessionThreadFunc function,
- gpointer data,
+session_thread_idle_add (ThreadClosure *thread_closure, SessionThreadFunc function, gpointer data,
GDestroyNotify notify)
{
IdleClosure *idle_closure;
@@ -235,27 +237,22 @@ session_thread_idle_add (ThreadClosure *thread_closure,
idle_closure->data = data;
idle_closure->notify = notify;
- g_main_context_invoke_full (thread_closure->main_context,
- G_PRIORITY_DEFAULT,
- session_thread_idle_dispatch,
- idle_closure, /* takes ownership */
- (GDestroyNotify) idle_closure_free);
+ g_main_context_invoke_full (thread_closure->main_context, G_PRIORITY_DEFAULT,
+ session_thread_idle_dispatch, idle_closure, /* takes ownership */
+ (GDestroyNotify)idle_closure_free);
}
static void
-session_thread_add_logger (ThreadClosure *thread_closure,
- gpointer data)
+session_thread_add_logger (ThreadClosure *thread_closure, gpointer data)
{
glnx_unref_object SoupLogger *logger = NULL;
logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, 500);
- soup_session_add_feature (thread_closure->session,
- SOUP_SESSION_FEATURE (logger));
+ soup_session_add_feature (thread_closure->session, SOUP_SESSION_FEATURE (logger));
}
static void
-session_thread_config_flags (ThreadClosure *thread_closure,
- gpointer data)
+session_thread_config_flags (ThreadClosure *thread_closure, gpointer data)
{
OstreeFetcherConfigFlags config_flags;
@@ -263,15 +260,13 @@ session_thread_config_flags (ThreadClosure *thread_closure,
if ((config_flags & OSTREE_FETCHER_FLAGS_TLS_PERMISSIVE) > 0)
{
- g_object_set (thread_closure->session,
- SOUP_SESSION_SSL_STRICT,
- FALSE, NULL);
+ g_object_set (thread_closure->session, SOUP_SESSION_SSL_STRICT, FALSE, NULL);
}
}
static void
-on_authenticate (SoupSession *session, SoupMessage *msg, SoupAuth *auth,
- gboolean retrying, gpointer user_data)
+on_authenticate (SoupSession *session, SoupMessage *msg, SoupAuth *auth, gboolean retrying,
+ gpointer user_data)
{
ThreadClosure *thread_closure = user_data;
@@ -282,51 +277,42 @@ on_authenticate (SoupSession *session, SoupMessage *msg, SoupAuth *auth,
if (retrying)
{
g_autofree char *s = soup_uri_to_string (uri, FALSE);
- g_set_error (&thread_closure->oob_error,
- G_IO_ERROR, G_IO_ERROR_PROXY_AUTH_FAILED,
+ g_set_error (&thread_closure->oob_error, G_IO_ERROR, G_IO_ERROR_PROXY_AUTH_FAILED,
"Invalid username or password for proxy '%s'", s);
}
else
- soup_auth_authenticate (auth, soup_uri_get_user (uri),
- soup_uri_get_password (uri));
+ soup_auth_authenticate (auth, soup_uri_get_user (uri), soup_uri_get_password (uri));
}
}
static void
-session_thread_set_proxy_cb (ThreadClosure *thread_closure,
- gpointer data)
+session_thread_set_proxy_cb (ThreadClosure *thread_closure, gpointer data)
{
SoupURI *proxy_uri = data;
- g_object_set (thread_closure->session,
- SOUP_SESSION_PROXY_URI,
- proxy_uri, NULL);
+ g_object_set (thread_closure->session, SOUP_SESSION_PROXY_URI, proxy_uri, NULL);
/* libsoup won't necessarily pass any embedded username and password to proxy
* requests, so we have to be ready to handle 407 and handle them ourselves.
* See also: https://bugzilla.gnome.org/show_bug.cgi?id=772932
* */
- if (soup_uri_get_user (proxy_uri) &&
- soup_uri_get_password (proxy_uri))
+ if (soup_uri_get_user (proxy_uri) && soup_uri_get_password (proxy_uri))
{
- g_signal_connect (thread_closure->session, "authenticate",
- G_CALLBACK (on_authenticate), thread_closure);
+ g_signal_connect (thread_closure->session, "authenticate", G_CALLBACK (on_authenticate),
+ thread_closure);
}
}
static void
-session_thread_set_cookie_jar_cb (ThreadClosure *thread_closure,
- gpointer data)
+session_thread_set_cookie_jar_cb (ThreadClosure *thread_closure, gpointer data)
{
SoupCookieJar *jar = data;
- soup_session_add_feature (thread_closure->session,
- SOUP_SESSION_FEATURE (jar));
+ soup_session_add_feature (thread_closure->session, SOUP_SESSION_FEATURE (jar));
}
static void
-session_thread_set_headers_cb (ThreadClosure *thread_closure,
- gpointer data)
+session_thread_set_headers_cb (ThreadClosure *thread_closure, gpointer data)
{
GVariant *headers = data;
@@ -336,27 +322,23 @@ session_thread_set_headers_cb (ThreadClosure *thread_closure,
#ifdef HAVE_LIBSOUP_CLIENT_CERTS
static void
-session_thread_set_tls_interaction_cb (ThreadClosure *thread_closure,
- gpointer data)
+session_thread_set_tls_interaction_cb (ThreadClosure *thread_closure, gpointer data)
{
const char *cert_and_key_path = data; /* str\0str\0 in one malloc buf */
const char *cert_path = cert_and_key_path;
const char *key_path = cert_and_key_path + strlen (cert_and_key_path) + 1;
- g_autoptr(OstreeTlsCertInteraction) interaction = NULL;
+ g_autoptr (OstreeTlsCertInteraction) interaction = NULL;
/* The GTlsInteraction instance must be created in the
* session thread so it uses the correct GMainContext. */
interaction = _ostree_tls_cert_interaction_new (cert_path, key_path);
- g_object_set (thread_closure->session,
- SOUP_SESSION_TLS_INTERACTION,
- interaction, NULL);
+ g_object_set (thread_closure->session, SOUP_SESSION_TLS_INTERACTION, interaction, NULL);
}
#endif
static void
-session_thread_set_tls_database_cb (ThreadClosure *thread_closure,
- gpointer data)
+session_thread_set_tls_database_cb (ThreadClosure *thread_closure, gpointer data)
{
const char *db_path = data;
@@ -368,27 +350,22 @@ session_thread_set_tls_database_cb (ThreadClosure *thread_closure,
tlsdb = g_tls_file_database_new (db_path, &thread_closure->initialization_error);
if (tlsdb)
- g_object_set (thread_closure->session,
- SOUP_SESSION_TLS_DATABASE,
- tlsdb, NULL);
+ g_object_set (thread_closure->session, SOUP_SESSION_TLS_DATABASE, tlsdb, NULL);
}
else
{
- g_object_set (thread_closure->session,
- SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE,
- TRUE, NULL);
+ g_object_set (thread_closure->session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE, NULL);
}
}
static void
-session_thread_set_extra_user_agent_cb (ThreadClosure *thread_closure,
- gpointer data)
+session_thread_set_extra_user_agent_cb (ThreadClosure *thread_closure, gpointer data)
{
const char *extra_user_agent = data;
if (extra_user_agent != NULL)
{
- g_autofree char *ua =
- g_strdup_printf ("%s %s", OSTREE_FETCHER_USERAGENT_STRING, extra_user_agent);
+ g_autofree char *ua
+ = g_strdup_printf ("%s %s", OSTREE_FETCHER_USERAGENT_STRING, extra_user_agent);
g_object_set (thread_closure->session, SOUP_SESSION_USER_AGENT, ua, NULL);
}
else
@@ -398,12 +375,10 @@ session_thread_set_extra_user_agent_cb (ThreadClosure *thread_closure,
}
}
-static void
-on_request_sent (GObject *object, GAsyncResult *result, gpointer user_data);
+static void on_request_sent (GObject *object, GAsyncResult *result, gpointer user_data);
static void
-start_pending_request (ThreadClosure *thread_closure,
- GTask *task)
+start_pending_request (ThreadClosure *thread_closure, GTask *task)
{
OstreeFetcherPendingURI *pending;
@@ -413,18 +388,14 @@ start_pending_request (ThreadClosure *thread_closure,
cancellable = g_task_get_cancellable (task);
g_hash_table_add (thread_closure->outstanding, pending_uri_ref (pending));
- soup_request_send_async (pending->request,
- cancellable,
- on_request_sent,
- g_object_ref (task));
+ soup_request_send_async (pending->request, cancellable, on_request_sent, g_object_ref (task));
}
static void
-create_pending_soup_request (OstreeFetcherPendingURI *pending,
- GError **error)
+create_pending_soup_request (OstreeFetcherPendingURI *pending, GError **error)
{
OstreeFetcherURI *next_mirror = NULL;
- g_autoptr(OstreeFetcherURI) uri = NULL;
+ g_autoptr (OstreeFetcherURI) uri = NULL;
g_assert (pending->mirrorlist);
g_assert (pending->mirrorlist_idx < pending->mirrorlist->len);
@@ -433,35 +404,36 @@ create_pending_soup_request (OstreeFetcherPendingURI *pending,
if (pending->filename)
uri = _ostree_fetcher_uri_new_subpath (next_mirror, pending->filename);
if (!uri)
- uri = (OstreeFetcherURI*)g_uri_ref ((GUri*)next_mirror);
+ uri = (OstreeFetcherURI *)g_uri_ref ((GUri *)next_mirror);
g_clear_object (&pending->request);
{
- g_autofree gchar *uri_str = g_uri_to_string ((GUri*)uri);
+ g_autofree gchar *uri_str = g_uri_to_string ((GUri *)uri);
pending->request = soup_session_request (pending->thread_closure->session, uri_str, error);
}
/* Add caching headers. */
if (SOUP_IS_REQUEST_HTTP (pending->request) && pending->if_none_match != NULL)
{
- glnx_unref_object SoupMessage *msg = soup_request_http_get_message ((SoupRequestHTTP*) pending->request);
+ glnx_unref_object SoupMessage *msg
+ = soup_request_http_get_message ((SoupRequestHTTP *)pending->request);
soup_message_headers_append (msg->request_headers, "If-None-Match", pending->if_none_match);
}
if (SOUP_IS_REQUEST_HTTP (pending->request) && pending->if_modified_since > 0)
{
- glnx_unref_object SoupMessage *msg = soup_request_http_get_message ((SoupRequestHTTP*) pending->request);
+ glnx_unref_object SoupMessage *msg
+ = soup_request_http_get_message ((SoupRequestHTTP *)pending->request);
- g_autoptr(GDateTime) date_time = g_date_time_new_from_unix_utc (pending->if_modified_since);
+ g_autoptr (GDateTime) date_time = g_date_time_new_from_unix_utc (pending->if_modified_since);
g_autofree char *mod_date = g_date_time_format (date_time, "%a, %d %b %Y %H:%M:%S %Z");
soup_message_headers_append (msg->request_headers, "If-Modified-Since", mod_date);
}
}
static void
-session_thread_request_uri (ThreadClosure *thread_closure,
- gpointer data)
+session_thread_request_uri (ThreadClosure *thread_closure, gpointer data)
{
GTask *task = G_TASK (data);
OstreeFetcherPendingURI *pending;
@@ -485,16 +457,17 @@ session_thread_request_uri (ThreadClosure *thread_closure,
return;
}
- {
- g_autofree gchar *uri_str = soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
- g_debug ("%s: starting request %p for URI %s, using GTask %p",
- G_STRFUNC, pending->request, uri_str, task);
- }
+ {
+ g_autofree gchar *uri_str = soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
+ g_debug ("%s: starting request %p for URI %s, using GTask %p", G_STRFUNC, pending->request,
+ uri_str, task);
+ }
if (SOUP_IS_REQUEST_HTTP (pending->request) && thread_closure->extra_headers)
{
- glnx_unref_object SoupMessage *msg = soup_request_http_get_message ((SoupRequestHTTP*) pending->request);
- g_autoptr(GVariantIter) viter = g_variant_iter_new (thread_closure->extra_headers);
+ glnx_unref_object SoupMessage *msg
+ = soup_request_http_get_message ((SoupRequestHTTP *)pending->request);
+ g_autoptr (GVariantIter) viter = g_variant_iter_new (thread_closure->extra_headers);
const char *key;
const char *value;
@@ -504,14 +477,11 @@ session_thread_request_uri (ThreadClosure *thread_closure,
if (pending->is_membuf)
{
- soup_request_send_async (pending->request,
- cancellable,
- on_request_sent,
- g_object_ref (task));
+ soup_request_send_async (pending->request, cancellable, on_request_sent, g_object_ref (task));
}
else
{
- start_pending_request (thread_closure, task);
+ start_pending_request (thread_closure, task);
}
}
@@ -519,7 +489,7 @@ static gpointer
ostree_fetcher_session_thread (gpointer data)
{
ThreadClosure *closure = data;
- g_autoptr(GMainContext) mainctx = g_main_context_ref (closure->main_context);
+ g_autoptr (GMainContext) mainctx = g_main_context_ref (closure->main_context);
/* This becomes the GMainContext that SoupSession schedules async
* callbacks and emits signals from. Make it the thread-default
@@ -527,13 +497,10 @@ ostree_fetcher_session_thread (gpointer data)
g_main_context_push_thread_default (mainctx);
/* We retain ownership of the SoupSession reference. */
- closure->session = soup_session_async_new_with_options (SOUP_SESSION_USER_AGENT, OSTREE_FETCHER_USERAGENT_STRING,
- SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
- SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
- SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_REQUESTER,
- SOUP_SESSION_TIMEOUT, 60,
- SOUP_SESSION_IDLE_TIMEOUT, 60,
- NULL);
+ closure->session = soup_session_async_new_with_options (
+ SOUP_SESSION_USER_AGENT, OSTREE_FETCHER_USERAGENT_STRING, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE,
+ TRUE, SOUP_SESSION_USE_THREAD_CONTEXT, TRUE, SOUP_SESSION_ADD_FEATURE_BY_TYPE,
+ SOUP_TYPE_REQUESTER, SOUP_SESSION_TIMEOUT, 60, SOUP_SESSION_IDLE_TIMEOUT, 60, NULL);
if (closure->transfer_gzip)
soup_session_add_feature_by_type (closure->session, SOUP_TYPE_CONTENT_DECODER);
@@ -547,15 +514,14 @@ ostree_fetcher_session_thread (gpointer data)
/* We download a lot of small objects in ostree, so this
* helps a lot. Also matches what most modern browsers do.
*
- * Note since https://github.com/ostreedev/ostree/commit/f4d1334e19ce3ab2f8872b1e28da52044f559401
- * we don't do queuing in this libsoup backend, but we still
- * want to override libsoup's currently conservative
- * #define SOUP_SESSION_MAX_CONNS_PER_HOST_DEFAULT 2 (as of 2018-02-14).
+ * Note since
+ * https://github.com/ostreedev/ostree/commit/f4d1334e19ce3ab2f8872b1e28da52044f559401 we
+ * don't do queuing in this libsoup backend, but we still want to override libsoup's
+ * currently conservative #define SOUP_SESSION_MAX_CONNS_PER_HOST_DEFAULT 2 (as of
+ * 2018-02-14).
*/
max_conns = _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS;
- g_object_set (closure->session,
- "max-conns-per-host",
- max_conns, NULL);
+ g_object_set (closure->session, "max-conns-per-host", max_conns, NULL);
}
/* This model ensures we don't hit a race using g_main_loop_quit();
@@ -582,40 +548,35 @@ ostree_fetcher_session_thread (gpointer data)
}
static void
-_ostree_fetcher_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+_ostree_fetcher_set_property (GObject *object, guint prop_id, const GValue *value,
+ GParamSpec *pspec)
{
OstreeFetcher *self = OSTREE_FETCHER (object);
switch (prop_id)
{
- case PROP_CONFIG_FLAGS:
- self->config_flags = g_value_get_flags (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ case PROP_CONFIG_FLAGS:
+ self->config_flags = g_value_get_flags (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
static void
-_ostree_fetcher_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+_ostree_fetcher_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
OstreeFetcher *self = OSTREE_FETCHER (object);
switch (prop_id)
{
- case PROP_CONFIG_FLAGS:
- g_value_set_flags (value, self->config_flags);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ case PROP_CONFIG_FLAGS:
+ g_value_set_flags (value, self->config_flags);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
@@ -644,7 +605,7 @@ static void
_ostree_fetcher_constructed (GObject *object)
{
OstreeFetcher *self = OSTREE_FETCHER (object);
- g_autoptr(GMainContext) main_context = NULL;
+ g_autoptr (GMainContext) main_context = NULL;
const char *http_proxy;
main_context = g_main_context_new ();
@@ -653,27 +614,25 @@ _ostree_fetcher_constructed (GObject *object)
self->thread_closure->ref_count = 1;
self->thread_closure->main_context = g_main_context_ref (main_context);
self->thread_closure->running = 1;
- self->thread_closure->transfer_gzip = (self->config_flags & OSTREE_FETCHER_FLAGS_TRANSFER_GZIP) != 0;
+ self->thread_closure->transfer_gzip
+ = (self->config_flags & OSTREE_FETCHER_FLAGS_TRANSFER_GZIP) != 0;
- self->thread_closure->outstanding = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)pending_uri_unref);
- self->thread_closure->output_stream_set = g_hash_table_new_full (NULL, NULL,
- (GDestroyNotify) NULL,
- (GDestroyNotify) g_object_unref);
+ self->thread_closure->outstanding
+ = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)pending_uri_unref);
+ self->thread_closure->output_stream_set
+ = g_hash_table_new_full (NULL, NULL, (GDestroyNotify)NULL, (GDestroyNotify)g_object_unref);
g_mutex_init (&self->thread_closure->output_stream_set_lock);
if (g_getenv ("OSTREE_DEBUG_HTTP"))
{
- session_thread_idle_add (self->thread_closure,
- session_thread_add_logger,
- NULL, (GDestroyNotify) NULL);
+ session_thread_idle_add (self->thread_closure, session_thread_add_logger, NULL,
+ (GDestroyNotify)NULL);
}
if (self->config_flags != 0)
{
- session_thread_idle_add (self->thread_closure,
- session_thread_config_flags,
- GUINT_TO_POINTER (self->config_flags),
- (GDestroyNotify) NULL);
+ session_thread_idle_add (self->thread_closure, session_thread_config_flags,
+ GUINT_TO_POINTER (self->config_flags), (GDestroyNotify)NULL);
}
http_proxy = g_getenv ("http_proxy");
@@ -682,8 +641,7 @@ _ostree_fetcher_constructed (GObject *object)
/* FIXME Maybe implement GInitableIface and use g_thread_try_new()
* so we can try to handle thread creation errors gracefully? */
- self->session_thread = g_thread_new ("fetcher-session-thread",
- ostree_fetcher_session_thread,
+ self->session_thread = g_thread_new ("fetcher-session-thread", ostree_fetcher_session_thread,
thread_closure_ref (self->thread_closure));
G_OBJECT_CLASS (_ostree_fetcher_parent_class)->constructed (object);
@@ -699,16 +657,11 @@ _ostree_fetcher_class_init (OstreeFetcherClass *klass)
gobject_class->finalize = _ostree_fetcher_finalize;
gobject_class->constructed = _ostree_fetcher_constructed;
- g_object_class_install_property (gobject_class,
- PROP_CONFIG_FLAGS,
- g_param_spec_flags ("config-flags",
- "",
- "",
- OSTREE_TYPE_FETCHER_CONFIG_FLAGS,
- OSTREE_FETCHER_FLAGS_NONE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (
+ gobject_class, PROP_CONFIG_FLAGS,
+ g_param_spec_flags ("config-flags", "", "", OSTREE_TYPE_FETCHER_CONFIG_FLAGS,
+ OSTREE_FETCHER_FLAGS_NONE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
static void
@@ -717,9 +670,7 @@ _ostree_fetcher_init (OstreeFetcher *self)
}
OstreeFetcher *
-_ostree_fetcher_new (int tmpdir_dfd,
- const char *remote_name,
- OstreeFetcherConfigFlags flags)
+_ostree_fetcher_new (int tmpdir_dfd, const char *remote_name, OstreeFetcherConfigFlags flags)
{
OstreeFetcher *self;
@@ -737,8 +688,7 @@ _ostree_fetcher_get_dfd (OstreeFetcher *fetcher)
}
void
-_ostree_fetcher_set_proxy (OstreeFetcher *self,
- const char *http_proxy)
+_ostree_fetcher_set_proxy (OstreeFetcher *self, const char *http_proxy)
{
SoupURI *proxy_uri;
@@ -753,16 +703,14 @@ _ostree_fetcher_set_proxy (OstreeFetcher *self,
}
else
{
- session_thread_idle_add (self->thread_closure,
- session_thread_set_proxy_cb,
- proxy_uri, /* takes ownership */
- (GDestroyNotify) soup_uri_free);
+ session_thread_idle_add (self->thread_closure, session_thread_set_proxy_cb,
+ proxy_uri, /* takes ownership */
+ (GDestroyNotify)soup_uri_free);
}
}
void
-_ostree_fetcher_set_cookie_jar (OstreeFetcher *self,
- const char *jar_path)
+_ostree_fetcher_set_cookie_jar (OstreeFetcher *self, const char *jar_path)
{
SoupCookieJar *jar;
@@ -771,18 +719,15 @@ _ostree_fetcher_set_cookie_jar (OstreeFetcher *self,
jar = soup_cookie_jar_text_new (jar_path, TRUE);
- session_thread_idle_add (self->thread_closure,
- session_thread_set_cookie_jar_cb,
- jar, /* takes ownership */
- (GDestroyNotify) g_object_unref);
+ session_thread_idle_add (self->thread_closure, session_thread_set_cookie_jar_cb,
+ jar, /* takes ownership */
+ (GDestroyNotify)g_object_unref);
}
void
-_ostree_fetcher_set_client_cert (OstreeFetcher *self,
- const char *cert_path,
- const char *key_path)
+_ostree_fetcher_set_client_cert (OstreeFetcher *self, const char *cert_path, const char *key_path)
{
- g_autoptr(GString) buf = NULL;
+ g_autoptr (GString) buf = NULL;
g_return_if_fail (OSTREE_IS_FETCHER (self));
if (cert_path)
@@ -793,51 +738,38 @@ _ostree_fetcher_set_client_cert (OstreeFetcher *self,
}
#ifdef HAVE_LIBSOUP_CLIENT_CERTS
- session_thread_idle_add (self->thread_closure,
- session_thread_set_tls_interaction_cb,
- g_string_free (g_steal_pointer (&buf), FALSE),
- (GDestroyNotify) g_free);
+ session_thread_idle_add (self->thread_closure, session_thread_set_tls_interaction_cb,
+ g_string_free (g_steal_pointer (&buf), FALSE), (GDestroyNotify)g_free);
#else
g_warning ("This version of OSTree is compiled without client side certificate support");
#endif
}
void
-_ostree_fetcher_set_tls_database (OstreeFetcher *self,
- const char *tlsdb_path)
+_ostree_fetcher_set_tls_database (OstreeFetcher *self, const char *tlsdb_path)
{
g_return_if_fail (OSTREE_IS_FETCHER (self));
- session_thread_idle_add (self->thread_closure,
- session_thread_set_tls_database_cb,
- g_strdup (tlsdb_path),
- (GDestroyNotify) g_free);
+ session_thread_idle_add (self->thread_closure, session_thread_set_tls_database_cb,
+ g_strdup (tlsdb_path), (GDestroyNotify)g_free);
}
void
-_ostree_fetcher_set_extra_headers (OstreeFetcher *self,
- GVariant *extra_headers)
+_ostree_fetcher_set_extra_headers (OstreeFetcher *self, GVariant *extra_headers)
{
- session_thread_idle_add (self->thread_closure,
- session_thread_set_headers_cb,
- g_variant_ref (extra_headers),
- (GDestroyNotify) g_variant_unref);
+ session_thread_idle_add (self->thread_closure, session_thread_set_headers_cb,
+ g_variant_ref (extra_headers), (GDestroyNotify)g_variant_unref);
}
void
-_ostree_fetcher_set_extra_user_agent (OstreeFetcher *self,
- const char *extra_user_agent)
+_ostree_fetcher_set_extra_user_agent (OstreeFetcher *self, const char *extra_user_agent)
{
- session_thread_idle_add (self->thread_closure,
- session_thread_set_extra_user_agent_cb,
- g_strdup (extra_user_agent),
- (GDestroyNotify) g_free);
+ session_thread_idle_add (self->thread_closure, session_thread_set_extra_user_agent_cb,
+ g_strdup (extra_user_agent), (GDestroyNotify)g_free);
}
static gboolean
-finish_stream (OstreeFetcherPendingURI *pending,
- GCancellable *cancellable,
- GError **error)
+finish_stream (OstreeFetcherPendingURI *pending, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
struct stat stbuf;
@@ -861,8 +793,7 @@ finish_stream (OstreeFetcherPendingURI *pending,
goto out;
g_mutex_lock (&pending->thread_closure->output_stream_set_lock);
- g_hash_table_remove (pending->thread_closure->output_stream_set,
- pending->out_stream);
+ g_hash_table_remove (pending->thread_closure->output_stream_set, pending->out_stream);
g_mutex_unlock (&pending->thread_closure->output_stream_set_lock);
}
@@ -890,15 +821,12 @@ finish_stream (OstreeFetcherPendingURI *pending,
}
ret = TRUE;
- out:
- (void) g_input_stream_close (pending->request_body, NULL, NULL);
+out:
+ (void)g_input_stream_close (pending->request_body, NULL, NULL);
return ret;
}
-static void
-on_stream_read (GObject *object,
- GAsyncResult *result,
- gpointer user_data);
+static void on_stream_read (GObject *object, GAsyncResult *result, gpointer user_data);
static void
remove_pending (OstreeFetcherPendingURI *pending)
@@ -912,9 +840,7 @@ remove_pending (OstreeFetcherPendingURI *pending)
}
static void
-on_out_splice_complete (GObject *object,
- GAsyncResult *result,
- gpointer user_data)
+on_out_splice_complete (GObject *object, GAsyncResult *result, gpointer user_data)
{
GTask *task = G_TASK (user_data);
OstreeFetcherPendingURI *pending;
@@ -925,19 +851,14 @@ on_out_splice_complete (GObject *object,
pending = g_task_get_task_data (task);
cancellable = g_task_get_cancellable (task);
- bytes_written = g_output_stream_splice_finish ((GOutputStream *)object,
- result,
- &local_error);
+ bytes_written = g_output_stream_splice_finish ((GOutputStream *)object, result, &local_error);
if (bytes_written < 0)
goto out;
- g_input_stream_read_bytes_async (pending->request_body,
- 8192, G_PRIORITY_DEFAULT,
- cancellable,
- on_stream_read,
- g_object_ref (task));
+ g_input_stream_read_bytes_async (pending->request_body, 8192, G_PRIORITY_DEFAULT, cancellable,
+ on_stream_read, g_object_ref (task));
- out:
+out:
if (local_error)
{
g_task_return_error (task, local_error);
@@ -948,14 +869,12 @@ on_out_splice_complete (GObject *object,
}
static void
-on_stream_read (GObject *object,
- GAsyncResult *result,
- gpointer user_data)
+on_stream_read (GObject *object, GAsyncResult *result, gpointer user_data)
{
GTask *task = G_TASK (user_data);
OstreeFetcherPendingURI *pending;
GCancellable *cancellable;
- g_autoptr(GBytes) bytes = NULL;
+ g_autoptr (GBytes) bytes = NULL;
gsize bytes_read;
GError *local_error = NULL;
@@ -969,7 +888,8 @@ on_stream_read (GObject *object,
{
if (!pending->is_membuf)
{
- if (!_ostree_fetcher_tmpf_from_flags (pending->flags, pending->thread_closure->base_tmpdir_dfd,
+ if (!_ostree_fetcher_tmpf_from_flags (pending->flags,
+ pending->thread_closure->base_tmpdir_dfd,
&pending->tmpf, &local_error))
goto out;
pending->out_stream = g_unix_output_stream_new (pending->tmpf.fd, FALSE);
@@ -986,7 +906,7 @@ on_stream_read (GObject *object,
}
/* Get a GBytes buffer */
- bytes = g_input_stream_read_bytes_finish ((GInputStream*)object, result, &local_error);
+ bytes = g_input_stream_read_bytes_finish ((GInputStream *)object, result, &local_error);
if (!bytes)
goto out;
bytes_read = g_bytes_get_size (bytes);
@@ -998,9 +918,10 @@ on_stream_read (GObject *object,
goto out;
if (pending->is_membuf)
{
- g_task_return_pointer (task,
- g_memory_output_stream_steal_as_bytes ((GMemoryOutputStream*)pending->out_stream),
- (GDestroyNotify) g_bytes_unref);
+ g_task_return_pointer (
+ task,
+ g_memory_output_stream_steal_as_bytes ((GMemoryOutputStream *)pending->out_stream),
+ (GDestroyNotify)g_bytes_unref);
}
else
{
@@ -1019,14 +940,15 @@ on_stream_read (GObject *object,
/* Verify max size */
if (pending->max_size > 0)
{
- if (bytes_read > pending->max_size ||
- (bytes_read + pending->current_size) > pending->max_size)
+ if (bytes_read > pending->max_size
+ || (bytes_read + pending->current_size) > pending->max_size)
{
- g_autofree char *uristr =
- soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
- local_error = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
- "URI %s exceeded maximum size of %" G_GUINT64_FORMAT " bytes",
- uristr, pending->max_size);
+ g_autofree char *uristr
+ = soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
+ local_error
+ = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
+ "URI %s exceeded maximum size of %" G_GUINT64_FORMAT " bytes",
+ uristr, pending->max_size);
goto out;
}
}
@@ -1037,18 +959,14 @@ on_stream_read (GObject *object,
* guaranteed to do a complete write.
*/
{
- g_autoptr(GInputStream) membuf =
- g_memory_input_stream_new_from_bytes (bytes);
+ g_autoptr (GInputStream) membuf = g_memory_input_stream_new_from_bytes (bytes);
g_output_stream_splice_async (pending->out_stream, membuf,
- G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
- G_PRIORITY_DEFAULT,
- cancellable,
- on_out_splice_complete,
- g_object_ref (task));
+ G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE, G_PRIORITY_DEFAULT,
+ cancellable, on_out_splice_complete, g_object_ref (task));
}
}
- out:
+out:
if (local_error)
{
g_task_return_error (task, local_error);
@@ -1059,9 +977,7 @@ on_stream_read (GObject *object,
}
static void
-on_request_sent (GObject *object,
- GAsyncResult *result,
- gpointer user_data)
+on_request_sent (GObject *object, GAsyncResult *result, gpointer user_data)
{
GTask *task = G_TASK (user_data);
/* Hold a ref to the pending across this function, since we remove
@@ -1072,11 +988,10 @@ on_request_sent (GObject *object,
glnx_unref_object SoupMessage *msg = NULL;
pending->state = OSTREE_FETCHER_STATE_COMPLETE;
- pending->request_body = soup_request_send_finish ((SoupRequest*) object,
- result, &local_error);
+ pending->request_body = soup_request_send_finish ((SoupRequest *)object, result, &local_error);
- g_debug ("%s: request %p (GTask %p) finished with request_body %p and error %s",
- G_STRFUNC, object, task, pending->request_body,
+ g_debug ("%s: request %p (GTask %p) finished with request_body %p and error %s", G_STRFUNC,
+ object, task, pending->request_body,
(local_error != NULL) ? local_error->message : "none");
if (!pending->request_body)
@@ -1085,9 +1000,9 @@ on_request_sent (GObject *object,
if (SOUP_IS_REQUEST_HTTP (object))
{
- msg = soup_request_http_get_message ((SoupRequestHTTP*) object);
- if (msg->status_code == SOUP_STATUS_NOT_MODIFIED &&
- (pending->if_none_match != NULL || pending->if_modified_since > 0))
+ msg = soup_request_http_get_message ((SoupRequestHTTP *)object);
+ if (msg->status_code == SOUP_STATUS_NOT_MODIFIED
+ && (pending->if_none_match != NULL || pending->if_modified_since > 0))
{
/* Version on the server is unchanged from the version we have cached locally;
* report this as an out-argument, a zero-length response buffer, and no error */
@@ -1103,14 +1018,14 @@ on_request_sent (GObject *object,
if (local_error != NULL)
goto out;
- (void) g_input_stream_close (pending->request_body, NULL, NULL);
+ (void)g_input_stream_close (pending->request_body, NULL, NULL);
start_pending_request (pending->thread_closure, task);
}
else
{
- g_autofree char *uristring =
- soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
+ g_autofree char *uristring
+ = soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
GIOErrorEnum code;
@@ -1137,17 +1052,15 @@ on_request_sent (GObject *object,
}
{
- g_autofree char *errmsg =
- g_strdup_printf ("Server returned status %u: %s",
- msg->status_code,
- soup_status_get_phrase (msg->status_code));
+ g_autofree char *errmsg
+ = g_strdup_printf ("Server returned status %u: %s", msg->status_code,
+ soup_status_get_phrase (msg->status_code));
/* Let's make OOB errors be the final one since they're probably
* the cause for the error here. */
if (pending->thread_closure->oob_error)
{
- local_error =
- g_error_copy (pending->thread_closure->oob_error);
+ local_error = g_error_copy (pending->thread_closure->oob_error);
g_prefix_error (&local_error, "%s: ", errmsg);
}
else
@@ -1155,15 +1068,13 @@ on_request_sent (GObject *object,
}
if (pending->mirrorlist->len > 1)
- g_prefix_error (&local_error,
- "All %u mirrors failed. Last error was: ",
+ g_prefix_error (&local_error, "All %u mirrors failed. Last error was: ",
pending->mirrorlist->len);
- if (pending->thread_closure->remote_name &&
- !((pending->flags & OSTREE_FETCHER_REQUEST_OPTIONAL_CONTENT) > 0 &&
- code == G_IO_ERROR_NOT_FOUND))
- _ostree_fetcher_journal_failure (pending->thread_closure->remote_name,
- uristring, local_error->message);
-
+ if (pending->thread_closure->remote_name
+ && !((pending->flags & OSTREE_FETCHER_REQUEST_OPTIONAL_CONTENT) > 0
+ && code == G_IO_ERROR_NOT_FOUND))
+ _ostree_fetcher_journal_failure (pending->thread_closure->remote_name, uristring,
+ local_error->message);
}
goto out;
}
@@ -1172,7 +1083,8 @@ on_request_sent (GObject *object,
pending->out_etag = g_strdup (soup_message_headers_get_one (msg->response_headers, "ETag"));
pending->out_last_modified = 0;
- const char *last_modified_str = soup_message_headers_get_one (msg->response_headers, "Last-Modified");
+ const char *last_modified_str
+ = soup_message_headers_get_one (msg->response_headers, "Last-Modified");
if (last_modified_str != NULL)
{
SoupDate *soup_date = soup_date_new_from_string (last_modified_str);
@@ -1188,17 +1100,14 @@ on_request_sent (GObject *object,
pending->content_length = soup_request_get_content_length (pending->request);
- g_input_stream_read_bytes_async (pending->request_body,
- 8192, G_PRIORITY_DEFAULT,
- cancellable,
- on_stream_read,
- g_object_ref (task));
+ g_input_stream_read_bytes_async (pending->request_body, 8192, G_PRIORITY_DEFAULT, cancellable,
+ on_stream_read, g_object_ref (task));
- out:
+out:
if (local_error)
{
if (pending->request_body)
- (void) g_input_stream_close (pending->request_body, NULL, NULL);
+ (void)g_input_stream_close (pending->request_body, NULL, NULL);
g_task_return_error (task, local_error);
remove_pending (pending);
}
@@ -1208,20 +1117,13 @@ on_request_sent (GObject *object,
}
static void
-_ostree_fetcher_request_async (OstreeFetcher *self,
- GPtrArray *mirrorlist,
- const char *filename,
- OstreeFetcherRequestFlags flags,
- const char *if_none_match,
- guint64 if_modified_since,
- gboolean is_membuf,
- guint64 max_size,
- int priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+_ostree_fetcher_request_async (OstreeFetcher *self, GPtrArray *mirrorlist, const char *filename,
+ OstreeFetcherRequestFlags flags, const char *if_none_match,
+ guint64 if_modified_since, gboolean is_membuf, guint64 max_size,
+ int priority, GCancellable *cancellable,
+ GAsyncReadyCallback callback, gpointer user_data)
{
- g_autoptr(GTask) task = NULL;
+ g_autoptr (GTask) task = NULL;
OstreeFetcherPendingURI *pending;
g_return_if_fail (OSTREE_IS_FETCHER (self));
@@ -1242,44 +1144,32 @@ _ostree_fetcher_request_async (OstreeFetcher *self,
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, _ostree_fetcher_request_async);
- g_task_set_task_data (task, pending, (GDestroyNotify) pending_uri_unref);
+ g_task_set_task_data (task, pending, (GDestroyNotify)pending_uri_unref);
/* We'll use the GTask priority for our own priority queue. */
g_task_set_priority (task, priority);
- session_thread_idle_add (self->thread_closure,
- session_thread_request_uri,
- g_object_ref (task),
- (GDestroyNotify) g_object_unref);
+ session_thread_idle_add (self->thread_closure, session_thread_request_uri, g_object_ref (task),
+ (GDestroyNotify)g_object_unref);
}
void
-_ostree_fetcher_request_to_tmpfile (OstreeFetcher *self,
- GPtrArray *mirrorlist,
- const char *filename,
- OstreeFetcherRequestFlags flags,
- const char *if_none_match,
- guint64 if_modified_since,
- guint64 max_size,
- int priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+_ostree_fetcher_request_to_tmpfile (OstreeFetcher *self, GPtrArray *mirrorlist,
+ const char *filename, OstreeFetcherRequestFlags flags,
+ const char *if_none_match, guint64 if_modified_since,
+ guint64 max_size, int priority, GCancellable *cancellable,
+ GAsyncReadyCallback callback, gpointer user_data)
{
- _ostree_fetcher_request_async (self, mirrorlist, filename, flags,
- if_none_match, if_modified_since, FALSE,
- max_size, priority, cancellable,
+ _ostree_fetcher_request_async (self, mirrorlist, filename, flags, if_none_match,
+ if_modified_since, FALSE, max_size, priority, cancellable,
callback, user_data);
}
gboolean
-_ostree_fetcher_request_to_tmpfile_finish (OstreeFetcher *self,
- GAsyncResult *result,
- GLnxTmpfile *out_tmpf,
- gboolean *out_not_modified,
- char **out_etag,
- guint64 *out_last_modified,
- GError **error)
+_ostree_fetcher_request_to_tmpfile_finish (OstreeFetcher *self, GAsyncResult *result,
+ GLnxTmpfile *out_tmpf, gboolean *out_not_modified,
+ char **out_etag, guint64 *out_last_modified,
+ GError **error)
{
GTask *task;
OstreeFetcherPendingURI *pending;
@@ -1288,7 +1178,7 @@ _ostree_fetcher_request_to_tmpfile_finish (OstreeFetcher *self,
g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
g_return_val_if_fail (g_async_result_is_tagged (result, _ostree_fetcher_request_async), FALSE);
- task = (GTask*)result;
+ task = (GTask *)result;
pending = g_task_get_task_data (task);
ret = g_task_propagate_pointer (task, error);
@@ -1310,32 +1200,22 @@ _ostree_fetcher_request_to_tmpfile_finish (OstreeFetcher *self,
}
void
-_ostree_fetcher_request_to_membuf (OstreeFetcher *self,
- GPtrArray *mirrorlist,
- const char *filename,
- OstreeFetcherRequestFlags flags,
- const char *if_none_match,
- guint64 if_modified_since,
- guint64 max_size,
- int priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+_ostree_fetcher_request_to_membuf (OstreeFetcher *self, GPtrArray *mirrorlist, const char *filename,
+ OstreeFetcherRequestFlags flags, const char *if_none_match,
+ guint64 if_modified_since, guint64 max_size, int priority,
+ GCancellable *cancellable, GAsyncReadyCallback callback,
+ gpointer user_data)
{
- _ostree_fetcher_request_async (self, mirrorlist, filename, flags,
- if_none_match, if_modified_since, TRUE,
- max_size, priority, cancellable,
- callback, user_data);
+ _ostree_fetcher_request_async (self, mirrorlist, filename, flags, if_none_match,
+ if_modified_since, TRUE, max_size, priority, cancellable, callback,
+ user_data);
}
gboolean
-_ostree_fetcher_request_to_membuf_finish (OstreeFetcher *self,
- GAsyncResult *result,
- GBytes **out_buf,
- gboolean *out_not_modified,
- char **out_etag,
- guint64 *out_last_modified,
- GError **error)
+_ostree_fetcher_request_to_membuf_finish (OstreeFetcher *self, GAsyncResult *result,
+ GBytes **out_buf, gboolean *out_not_modified,
+ char **out_etag, guint64 *out_last_modified,
+ GError **error)
{
GTask *task;
OstreeFetcherPendingURI *pending;
@@ -1344,7 +1224,7 @@ _ostree_fetcher_request_to_membuf_finish (OstreeFetcher *self,
g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
g_return_val_if_fail (g_async_result_is_tagged (result, _ostree_fetcher_request_async), FALSE);
- task = (GTask*)result;
+ task = (GTask *)result;
pending = g_task_get_task_data (task);
ret = g_task_propagate_pointer (task, error);
@@ -1365,9 +1245,8 @@ _ostree_fetcher_request_to_membuf_finish (OstreeFetcher *self,
return TRUE;
}
-
guint64
-_ostree_fetcher_bytes_transferred (OstreeFetcher *self)
+_ostree_fetcher_bytes_transferred (OstreeFetcher *self)
{
g_return_val_if_fail (OSTREE_IS_FETCHER (self), 0);
@@ -1375,12 +1254,11 @@ _ostree_fetcher_bytes_transferred (OstreeFetcher *self)
guint64 ret = self->thread_closure->total_downloaded;
- GLNX_HASH_TABLE_FOREACH (self->thread_closure->output_stream_set,
- GFileOutputStream*, stream)
+ GLNX_HASH_TABLE_FOREACH (self->thread_closure->output_stream_set, GFileOutputStream *, stream)
{
if (G_IS_FILE_DESCRIPTOR_BASED (stream))
{
- int fd = g_file_descriptor_based_get_fd ((GFileDescriptorBased*)stream);
+ int fd = g_file_descriptor_based_get_fd ((GFileDescriptorBased *)stream);
struct stat stbuf;
if (glnx_fstat (fd, &stbuf, NULL))