diff --git a/bin/xbps-bin/main.c b/bin/xbps-bin/main.c index 72ced70b..4ae86ad9 100644 --- a/bin/xbps-bin/main.c +++ b/bin/xbps-bin/main.c @@ -120,6 +120,7 @@ static void cleanup(int signum) { xbps_regpkgs_dictionary_release(); + xbps_fetch_unset_cache_connection(); exit(signum); } diff --git a/include/xbps_api.h b/include/xbps_api.h index c1d5c2b8..fd697fdc 100644 --- a/include/xbps_api.h +++ b/include/xbps_api.h @@ -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(). * diff --git a/lib/download.c b/lib/download.c index 48352331..81a36e6e 100644 --- a/lib/download.c +++ b/lib/download.c @@ -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)