From: Amos Jeffries Date: Mon, 16 Mar 2015 10:28:37 +0000 (-0700) Subject: Fix bug 4206 equivalent code in new ICAP logic X-Git-Tag: merge-candidate-3-v1~199^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=284e8d8d2c9425fb12b8ed7e04a6176649c96540;p=thirdparty%2Fsquid.git Fix bug 4206 equivalent code in new ICAP logic --- diff --git a/src/adaptation/icap/Xaction.cc b/src/adaptation/icap/Xaction.cc index 8ad56f6125..bd1a23d82a 100644 --- a/src/adaptation/icap/Xaction.cc +++ b/src/adaptation/icap/Xaction.cc @@ -376,10 +376,7 @@ void Adaptation::Icap::Xaction::scheduleRead() { Must(haveConnection()); Must(!reader); - - // TODO: tune this better to expected message sizes - readBuf.reserveCapacity(SQUID_TCP_SO_RCVBUF); - Must(readBuf.spaceSize()); + Must(readBuf.length() < SQUID_TCP_SO_RCVBUF); // will expand later if needed typedef CommCbMemFunT Dialer; reader = JobCallback(93, 3, Dialer, this, Adaptation::Icap::Xaction::noteCommRead); @@ -395,11 +392,13 @@ void Adaptation::Icap::Xaction::noteCommRead(const CommIoCbParams &io) Must(io.flag == Comm::OK); + // TODO: tune this better to expected message sizes + readBuf.reserveCapacity(SQUID_TCP_SO_RCVBUF); + CommIoCbParams rd(this); // will be expanded with ReadNow results rd.conn = io.conn; - rd.size = readBuf.spaceSize(); - switch (Comm::ReadNow(rd, readBuf)) { // XXX: SBuf convert readBuf + switch (Comm::ReadNow(rd, readBuf)) { case Comm::INPROGRESS: if (readBuf.isEmpty()) debugs(33, 2, io.conn << ": no data to process, " << xstrerr(rd.xerrno));