From 284e8d8d2c9425fb12b8ed7e04a6176649c96540 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 16 Mar 2015 03:28:37 -0700 Subject: [PATCH] Fix bug 4206 equivalent code in new ICAP logic --- src/adaptation/icap/Xaction.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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)); -- 2.47.2