From 14a93b2e436ed19c814653c3b2b61605fd5ca156 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 13 Aug 2009 21:01:40 -0500 Subject: Make fetch timeout actually 10 seconds We had 10000 as our timeout value, assuming it was expressed in ms. This is false after looking at the current code, so reset it back to 10 seconds. Addresses FS#15369. Signed-off-by: Dan McGee --- lib/libalpm/dload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 57c21b8e..fb778ee0 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -147,8 +147,8 @@ static int download_internal(const char *url, const char *localpath, /* libfetch does not reset the error code */ fetchLastErrCode = 0; - /* 10s timeout - TODO make a config option */ - fetchTimeout = 10000; + /* 10s timeout */ + fetchTimeout = 10; /* ignore any SIGPIPE signals- these may occur if our FTP socket dies or * something along those lines. Store the old signal handler first. */ -- cgit v1.2.3-24-g4f1b From 6f97842ab22eb50fdc689e8aa2e95688d015fa74 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Fri, 7 Aug 2009 16:58:01 +0200 Subject: 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 Signed-off-by: Dan McGee (cherry picked from commit d7675e393ff3cecb5408c243898ebaae80c5988d) --- lib/libalpm/dload.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'lib/libalpm') 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; } -- cgit v1.2.3-24-g4f1b