summaryrefslogtreecommitdiff
path: root/src/apk.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2023-04-17 15:39:04 +0300
committerTimo Teräs <timo.teras@iki.fi>2023-05-02 13:20:12 +0300
commit71ea076197410f7f1043762931b67338055a139e (patch)
tree4101290b7aab166aa59983b2bd4b60877a495136 /src/apk.c
parent06fef8ad8a936269a1868cbe1421ac72797f9a3e (diff)
downloadapk-tools-71ea076197410f7f1043762931b67338055a139e.tar.gz
apk-tools-71ea076197410f7f1043762931b67338055a139e.tar.bz2
apk-tools-71ea076197410f7f1043762931b67338055a139e.tar.xz
apk-tools-71ea076197410f7f1043762931b67338055a139e.zip
fetch: enable --timeout to set network progress timeout
implement it also for connecting to hosts fixes #10869
Diffstat (limited to 'src/apk.c')
-rw-r--r--src/apk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/apk.c b/src/apk.c
index 7505b1c..3baae46 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -99,6 +99,7 @@ static struct apk_repository_list *apk_repository_new(const char *url)
OPT(OPT_GLOBAL_repositories_file, APK_OPT_ARG "repositories-file") \
OPT(OPT_GLOBAL_repository, APK_OPT_ARG APK_OPT_SH("X") "repository") \
OPT(OPT_GLOBAL_root, APK_OPT_ARG APK_OPT_SH("p") "root") \
+ OPT(OPT_GLOBAL_timeout, APK_OPT_ARG "timeout") \
OPT(OPT_GLOBAL_update_cache, APK_OPT_SH("U") "update-cache") \
OPT(OPT_GLOBAL_verbose, APK_OPT_SH("v") "verbose") \
OPT(OPT_GLOBAL_version, APK_OPT_SH("V") "version") \
@@ -215,6 +216,9 @@ static int option_parse_global(void *ctx, struct apk_db_options *dbopts, int opt
case OPT_GLOBAL_cache_max_age:
dbopts->cache_max_age = atoi(optarg) * 60;
break;
+ case OPT_GLOBAL_timeout:
+ fetchTimeout = atoi(optarg);
+ break;
case OPT_GLOBAL_arch:
dbopts->arch = optarg;
break;
@@ -518,6 +522,7 @@ int main(int argc, char **argv)
init_openssl();
setup_automatic_flags();
+ fetchTimeout = 60;
fetchConnectionCacheInit(32, 4);
r = parse_options(argc, argv, applet, ctx, &dbopts);