diff --git a/src/libostree/ostree-fetcher-curl.c b/src/libostree/ostree-fetcher-curl.c index 422ed41649..c5198d5709 100644 --- a/src/libostree/ostree-fetcher-curl.c +++ b/src/libostree/ostree-fetcher-curl.c @@ -79,8 +79,8 @@ struct OstreeFetcher int tmpdir_dfd; bool force_anonymous; char *custom_user_agent; - long opt_low_speed_limit; - long opt_low_speed_time; + guint32 opt_low_speed_limit; + guint32 opt_low_speed_time; gboolean opt_retry_all; GMainContext *mainctx; @@ -186,9 +186,6 @@ _ostree_fetcher_finalize (GObject *object) g_free (self->tls_client_key_path); g_free (self->cookie_jar_path); g_free (self->proxy); - g_free (self->opt_low_speed_limit); - g_free (self->opt_low_speed_time); - g_free (self->opt_retry_all); g_assert_cmpint (g_hash_table_size (self->outstanding_requests), ==, 0); g_clear_pointer (&self->extra_headers, curl_slist_free_all); g_hash_table_unref (self->outstanding_requests); @@ -675,6 +672,24 @@ _ostree_fetcher_set_proxy (OstreeFetcher *self, const char *http_proxy) self->proxy = g_strdup (http_proxy); } +void +_ostree_fetcher_set_low_speed_time (OstreeFetcher *self, guint32 opt_low_speed_time) +{ + self->opt_low_speed_time = opt_low_speed_time; +} + +void +_ostree_fetcher_set_low_speed_limit (OstreeFetcher *self, guint32 opt_low_speed_limit) +{ + self->opt_low_speed_limit = opt_low_speed_limit; +} + +void +_ostree_fetcher_set_retry_all (OstreeFetcher *self, gboolean opt_retry_all) +{ + self->opt_retry_all = opt_retry_all; +} + void _ostree_fetcher_set_cookie_jar (OstreeFetcher *self, const char *jar_path) { diff --git a/src/libostree/ostree-fetcher.h b/src/libostree/ostree-fetcher.h index 6f1e931bc6..f69871b443 100644 --- a/src/libostree/ostree-fetcher.h +++ b/src/libostree/ostree-fetcher.h @@ -99,11 +99,11 @@ void _ostree_fetcher_set_proxy (OstreeFetcher *fetcher, const char *proxy); void _ostree_fetcher_set_client_cert (OstreeFetcher *fetcher, const char *cert_path, const char *key_path); -void _ostree_fetcher_set_low_speed_limit (OstreeFetcher *self, long *opt_low_speed_limit); +void _ostree_fetcher_set_low_speed_limit (OstreeFetcher *self, guint32 opt_low_speed_limit); -void _ostree_fetcher_set_low_speed_time (OstreeFetcher *self, long *opt_low_speed_time); +void _ostree_fetcher_set_low_speed_time (OstreeFetcher *self, guint32 opt_low_speed_time); -void _ostree_fetcher_set_retry_all (OstreeFetcher *self, gboolean *opt_retry_all; +void _ostree_fetcher_set_retry_all (OstreeFetcher *self, gboolean opt_retry_all); void _ostree_fetcher_set_tls_database (OstreeFetcher *self, const char *tlsdb_path); diff --git a/src/libostree/ostree-repo-pull-private.h b/src/libostree/ostree-repo-pull-private.h index 266b4e7b3f..93ba2a9134 100644 --- a/src/libostree/ostree-repo-pull-private.h +++ b/src/libostree/ostree-repo-pull-private.h @@ -54,8 +54,8 @@ typedef struct GVariant *extra_headers; char *append_user_agent; - long low_speed_limit; - long low_speed_time; + guint32 low_speed_limit; + guint32 low_speed_time; gboolean retry_all; diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index e2c7e3a29f..ef8c1d44d7 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -61,9 +61,9 @@ * _ostree_fetcher_should_retry_request(). This is the default value for the * `n-network-retries` pull option. */ #define DEFAULT_N_NETWORK_RETRIES 5 -#define OPT_LOWSPEEDLIMIT_DEFAULT 1000L -#define OPT_LOWSPEEDTIME_DEFAULT 30L -#define OPT_RETRYALL_DEFAULT true +#define OPT_LOWSPEEDLIMIT_DEFAULT 1000 +#define OPT_LOWSPEEDTIME_DEFAULT 30 +#define OPT_RETRYALL_DEFAULT TRUE typedef struct { @@ -2931,7 +2931,7 @@ _ostree_repo_cache_summary (OstreeRepo *self, const char *remote, GBytes *summar static OstreeFetcher * _ostree_repo_remote_new_fetcher (OstreeRepo *self, const char *remote_name, gboolean gzip, GVariant *extra_headers, const char *append_user_agent, - long low_speed_limit, long low_speed_time, + guint32 low_speed_limit, guint32 low_speed_time, gboolean retry_all, OstreeFetcherSecurityState *out_state, GError **error) { @@ -4914,9 +4914,6 @@ ostree_repo_pull_with_options (OstreeRepo *self, const char *remote_name_or_base g_free (pull_data->remote_refspec_name); g_free (pull_data->remote_name); g_free (pull_data->append_user_agent); - g_free (pull_data->low_speed_limit); - g_free (pull_data->low_speed_time); - g_free (pull_data->retry_all); g_clear_pointer (&pull_data->signapi_commit_verifiers, g_ptr_array_unref); g_clear_pointer (&pull_data->signapi_summary_verifiers, g_ptr_array_unref); g_clear_pointer (&pull_data->meta_mirrorlist, g_ptr_array_unref); @@ -5715,7 +5712,7 @@ find_remotes_cb (GObject *obj, GAsyncResult *async_result, gpointer user_data) goto error; fetcher = _ostree_repo_remote_new_fetcher (self, result->remote->name, TRUE, NULL, - NULL, NULL, NULL, TRUE, NULL, &error); + NULL, 0, 0, TRUE, NULL, &error); if (fetcher == NULL) goto error; @@ -6329,8 +6326,8 @@ ostree_repo_remote_fetch_summary_with_options (OstreeRepo *self, const char *nam g_autoptr (GVariant) extra_headers = NULL; g_autoptr (GPtrArray) mirrorlist = NULL; const char *append_user_agent = NULL; - long low_speed_limit = OPT_LOWSPEEDLIMIT_DEFAULT; - long low_speed_time = OPT_LOWSPEEDTIME_DEFAULT; + guint32 low_speed_limit = OPT_LOWSPEEDLIMIT_DEFAULT; + guint32 low_speed_time = OPT_LOWSPEEDTIME_DEFAULT; gboolean retry_all = OPT_RETRYALL_DEFAULT; guint n_network_retries = DEFAULT_N_NETWORK_RETRIES; gboolean summary_sig_not_modified = FALSE;