From: robertc <> Date: Thu, 7 Aug 2003 19:16:30 +0000 (+0000) Subject: Correct data channel management in case of errors while establishing the data channel... X-Git-Tag: SQUID_3_0_PRE3~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1be4874e2304964f8460d67a0507d0cc6294e421;p=thirdparty%2Fsquid.git Correct data channel management in case of errors while establishing the data channel - hno - bug #700 --- diff --git a/src/ftp.cc b/src/ftp.cc index f2ffeb9825..9305bec733 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.351 2003/08/04 22:14:42 robertc Exp $ + * $Id: ftp.cc,v 1.352 2003/08/07 13:16:30 robertc Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -352,6 +352,14 @@ static void ftpStateFree(int fdnotused, void *data) { FtpStateData *ftpState = (FtpStateData *)data; + ftpState->ctrl.fd = -1; + + if (ftpState->data.fd > -1) { + int fd = ftpState->data.fd; + ftpState->data.fd = -1; + comm_close(fd); + } + delete ftpState; } @@ -411,11 +419,6 @@ FtpStateData::~FtpStateData() safe_free(ftpState->filepath); safe_free(ftpState->data.host); - - if (ftpState->data.fd > -1) { - comm_close(ftpState->data.fd); - ftpState->data.fd = -1; - } } static void @@ -2142,7 +2145,7 @@ ftpSendPasv(FtpStateData * ftpState) /* * ugly hack for ftp servers like ftp.netscape.com that sometimes - * dont acknowledge PORT commands. + * dont acknowledge PASV commands. */ commSetTimeout(ftpState->data.fd, 15, ftpTimeout, ftpState); }