wget waitretry PATCH
Jim Wright <[email protected]>
| Newsgroups | gmane.comp.web.wget.patches |
|---|---|
| Message-ID | <[email protected]> |
Here is a small, ugly patch. I intended to clean this up and submit it long ago but so much for intentions. With the short deadline for feature freeze, I want to get this in ASAP. This patch is against the second release of wget-1.10-alpha1. This modifies the semantics of the "waitretry" command line option so that it specifies exactly the number of seconds to wait before retrying. I believe if wget is called with "--waitretry=5", then the seconds waited between succesive attempts to get a file will be 1, 2, 3, 4, 5, 5, 5... seconds. However, there are situations where this behavior is not desired. For example, a couple stations I deal with have a buggy FTP server which requires me to wait 8 minutes between attempts. Hitting the server any more frequently will trigger a bug in the server's code and and will prevent me from resuming the download of the file. Using the original semantics for --waitretry=480 simply will not work for me. I think the correct approach would be to implement my semantics for --waitretry, and to introduce a new switch such as --waitretrylimit for the current behavior. Thus the user has the option of a fixed wait between retries of a file, or a linear backoff on waits before retries. The man page explanation of the current behavior is misleading, in that it implies that --waitretry=10 will have a maximum wait of 55 seconds. If --tries=20 is also specified, then the current implementation would have a maximum wait of 1+2+3+...+9+10+10+...+10 = 155 seconds. Again, documentation and change log is missing. This can be developed if the idea is accepted. Thanks for your consideration. Jim Wright Data Flow/Archive Software Engineer Plate Boundary Observatory
waitretry.patch
(text/plain, 653 B)
--- wget-1.10-alpha1/src/retr.c 2005-03-20 08:07:40.000000000 -0700
+++ wget-1.10-alpha1-JRW/src/retr.c 2005-04-05 15:40:13.859803926 -0600
@@ -879,12 +879,17 @@
if (opt.waitretry && count > 1)
{
+#ifdef ORIGINAL_WAITRETRY
/* If opt.waitretry is specified and this is a retry, wait for
COUNT-1 number of seconds, or for opt.waitretry seconds. */
if (count <= opt.waitretry)
xsleep (count - 1);
else
xsleep (opt.waitretry);
+#else
+ /* change semantics so waitretry specifies exactly the seconds between retries */
+ xsleep (opt.waitretry);
+#endif
}
else if (opt.wait)
{