From: Amos Jeffries Date: Sat, 12 Mar 2011 03:34:48 +0000 (+1300) Subject: Remove redundant FTP/Gopher checks X-Git-Tag: take06~27^2~93 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=006f376d6a48ae3833095e0cc8c1c660a71e5284;p=thirdparty%2Fsquid.git Remove redundant FTP/Gopher checks Identified by ICC. --- diff --git a/src/ftp.cc b/src/ftp.cc index 8490922705..5858e024d3 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1270,7 +1270,7 @@ FtpStateData::dataRead(const CommIoCbParams &io) IOStats.Ftp.read_hist[bin]++; } - if (io.flag != COMM_OK || io.size < 0) { + if (io.flag != COMM_OK) { debugs(50, ignoreErrno(io.xerrno) ? 3 : DBG_IMPORTANT, "ftpDataRead: read error: " << xstrerr(io.xerrno)); @@ -1769,7 +1769,7 @@ void FtpStateData::ftpReadControlReply(const CommIoCbParams &io) fd_bytes(io.fd, io.size, FD_READ); } - if (io.flag != COMM_OK || io.size < 0) { + if (io.flag != COMM_OK) { debugs(50, ignoreErrno(io.xerrno) ? 3 : DBG_IMPORTANT, "ftpReadControlReply: read error: " << xstrerr(io.xerrno)); @@ -1778,9 +1778,7 @@ void FtpStateData::ftpReadControlReply(const CommIoCbParams &io) } else { failed(ERR_READ_ERROR, io.xerrno); /* failed closes ctrl.fd and frees ftpState */ - return; } - return; } diff --git a/src/gopher.cc b/src/gopher.cc index 5204526241..fa78bf26e6 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -776,7 +776,6 @@ gopherReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void int clen; int bin; size_t read_sz = BUFSIZ; - int do_next_read = 0; #if USE_DELAY_POOLS DelayId delayId = entry->mem_obj->mostBytesAllowed(); #endif @@ -826,26 +825,23 @@ gopherReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void req->hier.bodyBytesRead = 0; req->hier.bodyBytesRead += len; - } - if (flag != COMM_OK || len < 0) { + if (flag != COMM_OK) { debugs(50, 1, "gopherReadReply: error reading: " << xstrerror()); if (ignoreErrno(errno)) { - do_next_read = 1; + comm_read(fd, buf, read_sz, gopherReadReply, gopherState); } else { ErrorState *err; err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR, gopherState->fwd->request); err->xerrno = errno; gopherState->fwd->fail(err); comm_close(fd); - do_next_read = 0; } } else if (len == 0 && entry->isEmpty()) { gopherState->fwd->fail(errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE, gopherState->fwd->request)); comm_close(fd); - do_next_read = 0; } else if (len == 0) { /* Connection closed; retrieval done. */ /* flush the rest of data in temp buf if there is one. */ @@ -854,28 +850,17 @@ gopherReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void gopherEndHTML(gopherState); entry->timestampsSet(); - entry->flush(); - gopherState->fwd->complete(); - comm_close(fd); - - do_next_read = 0; } else { if (gopherState->conversion != gopher_ds::NORMAL) { gopherToHTML(gopherState, buf, len); } else { entry->append(buf, len); } - - do_next_read = 1; - } - - if (do_next_read) comm_read(fd, buf, read_sz, gopherReadReply, gopherState); - - return; + } } /**