Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorXavier Chantry <shiningxc@gmail.com>2009-08-07 16:58:01 +0200
committerDan McGee <dan@archlinux.org>2009-08-18 20:41:47 -0500
commit6f97842ab22eb50fdc689e8aa2e95688d015fa74 (patch)
treee8d28c429018cd8322f63b2db5a1c3a9d289d20d /lib/libalpm
parent8a55b793631f37dbe7f906cd55d0997f920d36e8 (diff)
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> (cherry picked from commit d7675e393ff3cecb5408c243898ebaae80c5988d)
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/dload.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index fb778ee0..4695731a 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -124,6 +124,10 @@ static int download_internal(const char *url, const char *localpath,
destfile = get_destfile(localpath, filename);
tempfile = get_tempfile(localpath, filename);
+ if(mtimeold) {
+ fileurl->last_modified = mtimeold;
+ }
+
/* pass the raw filename for passing to the callback function */
_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, &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) {
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);
}
- 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) {
*mtimenew = ust.mtime;
}