From: Amos Jeffries Date: Thu, 13 Nov 2014 12:09:11 +0000 (-0800) Subject: Fix delay pool DeferredRead in HttpStateData X-Git-Tag: merge-candidate-3-v1~240^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4a083cc245dd48cdbbff612046969abb7104b0d;p=thirdparty%2Fsquid.git Fix delay pool DeferredRead in HttpStateData The deferred read action may have been delayed so long the read(2) is no longer possible. It needs to restart from watching the socket instead of just from performing read(2). This re-adds part of the latency when delaying traffic but we retain the bytesWanted() speed up so not a big loss. --- diff --git a/src/http.cc b/src/http.cc index 4caa3d1146..161122a24d 100644 --- a/src/http.cc +++ b/src/http.cc @@ -24,6 +24,7 @@ #include "comm/Connection.h" #include "comm/Read.h" #include "comm/Write.h" +#include "CommRead.h" #include "err_detail_type.h" #include "errorpage.h" #include "fd.h" @@ -1126,6 +1127,15 @@ HttpStateData::persistentConnStatus() const return statusIfComplete(); } +#if USE_DELAY_POOLS +static void +readDelayed(void *context, CommRead const &) +{ + HttpStateData *state = static_cast(context); + state->maybeReadVirginBody(); +} +#endif + void HttpStateData::readReply(const CommIoCbParams &io) { @@ -1161,18 +1171,16 @@ HttpStateData::readReply(const CommIoCbParams &io) if (rd.size < 1) { assert(entry->mem_obj); - typedef CommCbMemFunT Dialer; - AsyncCall::Pointer call = JobCallback(11, 5, Dialer, this, HttpStateData::readReply); - /* read ahead limit */ /* Perhaps these two calls should both live in MemObject */ + AsyncCall::Pointer nilCall; if (!entry->mem_obj->readAheadPolicyCanRead()) { - entry->mem_obj->delayRead(DeferredRead(DeferReader, this, CommRead(io.conn, NULL, 0, call))); + entry->mem_obj->delayRead(DeferredRead(readDelayed, this, CommRead(io.conn, NULL, 0, nilCall))); return; } /* delay id limit */ - entry->mem_obj->mostBytesAllowed().delayRead(DeferredRead(DeferReader, this, CommRead(io.conn, NULL, 0, call))); + entry->mem_obj->mostBytesAllowed().delayRead(DeferredRead(readDelayed, this, CommRead(io.conn, NULL, 0, nilCall))); return; } #endif