[PATCH] setup: fix FTP behavior on timeout
Igor Pechtchanski
pechtcha@cs.nyu.edu
Tue Sep 27 17:07:00 GMT 2005
Hi,
I noticed this problem when trying to do a fresh install -- if selecting
packages takes too long, ftp mirrors will timeout, and setup will not
reconnect, causing the failure. This patch fixes that.
As usual, the ChangeLog is below.
Igor
==============================================================================
2005-09-27 Igor Pechtchanski <pechtcha@cs.nyu.edu>
* nio-ftp.cc (NetIO_FTP::NetIO_FTP): Reconnect on FTP timeout.
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA
-------------- next part --------------
Index: nio-ftp.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/nio-ftp.cc,v
retrieving revision 2.15
diff -u -p -r2.15 nio-ftp.cc
--- nio-ftp.cc 27 Dec 2004 16:12:44 -0000 2.15
+++ nio-ftp.cc 27 Sep 2005 15:58:16 -0000
@@ -63,6 +63,7 @@ NetIO_FTP::NetIO_FTP (char const *Purl):
if (port == 0)
port = 21;
+control_reconnect:
if (cmd_host && strcmp (host, cmd_host) != 0 || port != cmd_port)
{
if (cmd)
@@ -122,6 +123,13 @@ NetIO_FTP::NetIO_FTP (char const *Purl):
code = ftp_line (cmd);
}
while (code == 226); /* previous RETR */
+ if (code == 421) /* Timeout, retry */
+ {
+ log (LOG_BABBLE) << "FTP timeout -- reconnecting" << endLog;
+ delete [] cmd_host;
+ cmd_host = new char[1]; cmd_host[0] = '\0';
+ goto control_reconnect;
+ }
if (code != 227)
return;
More information about the Cygwin-apps
mailing list