Some changes for the XBPS libfetch's frontend code.
1) Raise the cache connection settings to more sane defaults (8->6, 16->2). 2) Introduce xbps_fetch_unset_cache_connection() to drop the caches.
This commit is contained in:
parent
9c60862e0f
commit
8ef8d86c12
@ -120,6 +120,7 @@ static void
|
||||
cleanup(int signum)
|
||||
{
|
||||
xbps_regpkgs_dictionary_release();
|
||||
xbps_fetch_unset_cache_connection();
|
||||
exit(signum);
|
||||
}
|
||||
|
||||
|
@ -223,14 +223,14 @@ int xbps_cmpver(const char *pkg1, const char *pkg2);
|
||||
*
|
||||
* Default (global) limit of cached connections used in libfetch.
|
||||
*/
|
||||
#define XBPS_FETCH_CACHECONN 8
|
||||
#define XBPS_FETCH_CACHECONN 6
|
||||
|
||||
/**
|
||||
* @def XBPS_FETCH_CACHECONN_HOST
|
||||
*
|
||||
* Default (per host) limit of cached connections used in libfetch.
|
||||
*/
|
||||
#define XBPS_FETCH_CACHECONN_HOST 16
|
||||
#define XBPS_FETCH_CACHECONN_HOST 2
|
||||
|
||||
/**
|
||||
* Download a file from a remote URL.
|
||||
@ -259,6 +259,11 @@ int xbps_fetch_file(const char *uri,
|
||||
*/
|
||||
void xbps_fetch_set_cache_connection(int global, int per_host);
|
||||
|
||||
/**
|
||||
* Destroys the libfetch's cache connection established.
|
||||
*/
|
||||
void xbps_fetch_unset_cache_connection(void);
|
||||
|
||||
/**
|
||||
* Returns last error string reported by xbps_fetch_file().
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2009 Juan Romero Pardines
|
||||
* Copyright (c) 2009-2010 Juan Romero Pardines
|
||||
* Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -130,6 +130,7 @@ stat_display(struct xferstat *xsp)
|
||||
if (xsp->size > 0 && xsp->rcvd > 0 &&
|
||||
xsp->last.tv_sec >= xsp->start.tv_sec + 10)
|
||||
fprintf(stderr, " ETA: %s", stat_eta(xsp));
|
||||
fprintf(stderr, "\033[K");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -201,6 +202,12 @@ xbps_fetch_set_cache_connection(int global, int per_host)
|
||||
fetchConnectionCacheInit(global, per_host);
|
||||
}
|
||||
|
||||
void
|
||||
xbps_fetch_unset_cache_connection(void)
|
||||
{
|
||||
fetchConnectionCacheClose();
|
||||
}
|
||||
|
||||
int
|
||||
xbps_fetch_file(const char *uri, const char *outputdir, bool refetch,
|
||||
const char *flags)
|
||||
|
Loading…
Reference in New Issue
Block a user