mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-09 13:07:58 -05:00
dload.c : change the way to check for mtimes
libfetch supports checking mtime so we do not need to do it manually. when the databases are already up-to-date, initiating a connection with fetchXGet and closing it right after with fetchIO_close took a very long time (up to 10min!) on some network. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
aba58e95ab
commit
d7675e393f
@ -124,6 +124,10 @@ static int download_internal(const char *url, const char *localpath,
|
|||||||
destfile = get_destfile(localpath, filename);
|
destfile = get_destfile(localpath, filename);
|
||||||
tempfile = get_tempfile(localpath, filename);
|
tempfile = get_tempfile(localpath, filename);
|
||||||
|
|
||||||
|
if(mtimeold) {
|
||||||
|
fileurl->last_modified = mtimeold;
|
||||||
|
}
|
||||||
|
|
||||||
/* pass the raw filename for passing to the callback function */
|
/* pass the raw filename for passing to the callback function */
|
||||||
_alpm_log(PM_LOG_DEBUG, "using '%s' for download progress\n", filename);
|
_alpm_log(PM_LOG_DEBUG, "using '%s' for download progress\n", filename);
|
||||||
|
|
||||||
@ -157,7 +161,13 @@ static int download_internal(const char *url, const char *localpath,
|
|||||||
sigaction(SIGPIPE, NULL, &old_action);
|
sigaction(SIGPIPE, NULL, &old_action);
|
||||||
sigaction(SIGPIPE, &new_action, NULL);
|
sigaction(SIGPIPE, &new_action, NULL);
|
||||||
|
|
||||||
dlf = fetchXGet(fileurl, &ust, (handle->nopassiveftp ? "" : "p"));
|
dlf = fetchXGet(fileurl, &ust, (handle->nopassiveftp ? "i" : "pi"));
|
||||||
|
|
||||||
|
if(fetchLastErrCode == FETCH_UNCHANGED) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "mtimes are identical, skipping %s\n", filename);
|
||||||
|
ret = 1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if(fetchLastErrCode != 0 || dlf == NULL) {
|
if(fetchLastErrCode != 0 || dlf == NULL) {
|
||||||
const char *host = _("disk");
|
const char *host = _("disk");
|
||||||
@ -173,12 +183,6 @@ static int download_internal(const char *url, const char *localpath,
|
|||||||
_alpm_log(PM_LOG_DEBUG, "connected to %s successfully\n", fileurl->host);
|
_alpm_log(PM_LOG_DEBUG, "connected to %s successfully\n", fileurl->host);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ust.mtime && mtimeold && ust.mtime == mtimeold) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "mtimes are identical, skipping %s\n", filename);
|
|
||||||
ret = 1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ust.mtime && mtimenew) {
|
if(ust.mtime && mtimenew) {
|
||||||
*mtimenew = ust.mtime;
|
*mtimenew = ust.mtime;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user