From: Alex Rousskov Date: Fri, 23 May 2014 06:34:59 +0000 (-0600) Subject: Revised ftp-gw timeout handling to cope with very long data downloads/uploads X-Git-Tag: SQUID_3_5_0_1~117^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5948d8e9b92cdd593918ce998c17edf123c1a760;p=thirdparty%2Fsquid.git Revised ftp-gw timeout handling to cope with very long data downloads/uploads that triggered bogus ctrl connection timeouts due to ctrl channel inactivity. Unset ctrl timeout when we are done waiting for the ctrl response (ServerStateData::readControlReply). Removed code setting data timeout from Ftp::ServerStateData::dataRead() because the data timeout is set in ServerStateData::maybeReadVirginBody() that dataRead calls to read data. Removed switchTimeoutToDataChannel() from Ftp::Gateway::ServerStateData::startDataDownload because * ctrl timeout should be cleared when we are done waiting for the ctrl response (ServerStateData::readControlReply) and * data timeout should be set when we start waiting for the data (ServerStateData::maybeReadVirginBody) Unset channel timeout in FtpChannel::forget(). Same as ftp-gw r12798. --- diff --git a/src/FtpGatewayServer.cc b/src/FtpGatewayServer.cc index 3c687f14c5..b9cefc753b 100644 --- a/src/FtpGatewayServer.cc +++ b/src/FtpGatewayServer.cc @@ -401,7 +401,6 @@ ServerStateData::startDataDownload() setVirginReply(reply); adaptOrFinalizeReply(); - switchTimeoutToDataChannel(); maybeReadVirginBody(); state = READING_DATA; } diff --git a/src/FtpServer.cc b/src/FtpServer.cc index cc9ffaa455..4456445bc2 100644 --- a/src/FtpServer.cc +++ b/src/FtpServer.cc @@ -88,8 +88,10 @@ FtpChannel::close() void FtpChannel::forget() { - if (Comm::IsConnOpen(conn)) + if (Comm::IsConnOpen(conn)) { + commUnsetConnTimeout(conn); comm_remove_close_handler(conn->fd, closer); + } clear(); } @@ -335,6 +337,8 @@ ServerStateData::readControlReply(const CommIoCbParams &io) unsigned int len =io.size + ctrl.offset; ctrl.offset = len; assert(len <= ctrl.size); + if (Comm::IsConnOpen(ctrl.conn)) + commUnsetConnTimeout(ctrl.conn); // we are done waiting for ctrl reply handleControlReply(); } @@ -899,12 +903,6 @@ ServerStateData::dataRead(const CommIoCbParams &io) HERE << "read error: " << xstrerr(io.xerrno)); if (ignoreErrno(io.xerrno)) { - typedef CommCbMemFunT TimeoutDialer; - AsyncCall::Pointer timeoutCall = - JobCallback(9, 5, TimeoutDialer, this, - ServerStateData::timeout); - commSetConnTimeout(io.conn, Config.Timeout.read, timeoutCall); - maybeReadVirginBody(); } else { failed(ERR_READ_ERROR, 0);