Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=2216edc5fac6f6c4fc1f78c751c1fc047d39a235

commit 2216edc5fac6f6c4fc1f78c751c1fc047d39a235
Author: Elentir <[email protected]>
Date:   Tue Jan 17 20:41:22 2012 +0100

server: set a non-zero timeout

diff --git a/lib/libpacman/server.c b/lib/libpacman/server.c
index 4ba2e6d..7b6b055 100644
--- a/lib/libpacman/server.c
+++ b/lib/libpacman/server.c
@@ -29,6 +29,7 @@
#include <time.h>
#include <sys/time.h>
#include <ftplib.h>
+#include <errno.h>

/* pacman-g2 */
#include "config.h"
@@ -228,6 +229,7 @@ int _pacman_downloadfiles_forreal(pmlist_t *servers, const 
char *localpath,
FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control);
+                               FtpOptions(FTPLIB_LOSTTIME, (long)5, control);
}
}

@@ -412,6 +414,11 @@ int _pacman_downloadfiles_forreal(pmlist_t *servers, const 
char *localpath,
_pacman_log(PM_LOG_WARNING, _("\nfailed downloading %s from %s: %s\n"),
fn, server->server, FtpLastResponse(control));
/* we leave the partially downloaded file in place so it can be resumed later */
+                                                       
if(!strncmp(FtpLastResponse(control), strerror(ETIMEDOUT), 254)) {
+                                                               pm_errno = 
PM_ERR_RETRIEVE;
+                                                               goto error;
+                                                       }
+
} else {
_pacman_log(PM_LOG_DEBUG, _("downloaded %s from %s\n"),
fn, server->server);
@@ -451,6 +458,7 @@ int _pacman_downloadfiles_forreal(pmlist_t *servers, const 
char *localpath,
FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control);
+                                                       
FtpOptions(FTPLIB_LOSTTIME, (long)5, control);
}
}

@@ -498,6 +506,8 @@ int _pacman_downloadfiles_forreal(pmlist_t *servers, const 
char *localpath,
src, server->server, FtpLastResponse(control));
pm_errno = PM_ERR_RETRIEVE;
/* we leave the partially downloaded file in place so it can be resumed later */
+                                                       
if(!strncmp(FtpLastResponse(control), strerror(ETIMEDOUT), 254))
+                                                               goto error;
}
} else {
if(mtime2) {
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to