setup: patch for ftp deadlock
Corinna Vinschen
corinna-cygwin@cygwin.com
Sat Mar 13 11:11:00 GMT 2010
On Mar 12 14:19, DJ Delorie wrote:
> It was a little weird working on my own code from so long ago, but...
>
> We needed this patch on our local version of setup to fix a deadlock
> between the FTP data socket and the PASV command, the RFC suggests
> closing out the data socket before starting the next transaction, so
> that's what this tries to do. When read() returns EOF, we check for
> the end-of-transaction status code on the command socket so that the
> server closes out the socket properly before we get to the next PASV
> command.
>
> With our FTP server, the PASV command didn't work if you issue it
> before reading the status from the RETR, so we waited forever for the
> PASV status code which never came.
>
> * nio-ftp.c (read): Read RETR status code on EOF to avoid
> deadlock with PASV.
>
> diff -U 3 -r rhsetup-src/nio-ftp.cc setup/nio-ftp.cc
> --- rhsetup-src/nio-ftp.cc 2008-04-08 19:50:54.000000000 -0400
> +++ setup/nio-ftp.cc 2010-03-11 23:09:42.000000000 -0500
> @@ -174,7 +174,11 @@
> int
> NetIO_FTP::read (char *buf, int nbytes)
> {
> + int rv, code;
> if (!ok ())
> return 0;
> - return s->read (buf, nbytes);
> + rv = s->read (buf, nbytes);
> + if (rv == 0)
> + code = ftp_line (cmd);
> + return rv;
> }
Thanks, applied.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
More information about the Cygwin-apps
mailing list