From: Amos Jeffries Date: Sat, 8 Mar 2014 00:47:39 +0000 (-0800) Subject: Shuffle maybeMakeSpaceAvailable() to ConnStateData::In X-Git-Tag: SQUID_3_5_0_1~321^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a64f7f1191d1536ff3079e32bb6b6b5aa8dcc3a;p=thirdparty%2Fsquid.git Shuffle maybeMakeSpaceAvailable() to ConnStateData::In maybeMakeSpaceAvailable() is an operation only for the buffer from ConnStateData::In. --- diff --git a/src/client_side.cc b/src/client_side.cc index 95c809c331..54f11b4551 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -248,7 +248,7 @@ ConnStateData::readSomeData() debugs(33, 4, HERE << clientConnection << ": reading request..."); - if (!maybeMakeSpaceAvailable()) + if (!in.maybeMakeSpaceAvailable()) return; typedef CommCbMemFunT Dialer; @@ -2375,19 +2375,19 @@ parseHttpRequest(ConnStateData *csd, HttpParser *hp, HttpRequestMethod * method_ } bool -ConnStateData::maybeMakeSpaceAvailable() +ConnStateData::In::maybeMakeSpaceAvailable() { - if (in.buf.spaceSize() < 2) { - const SBuf::size_type haveCapacity = in.buf.length() + in.buf.spaceSize(); + if (buf.spaceSize() < 2) { + const SBuf::size_type haveCapacity = buf.length() + buf.spaceSize(); if (haveCapacity >= Config.maxRequestBufferSize) { debugs(33, 4, "request buffer full: client_request_buffer_max_size=" << Config.maxRequestBufferSize); return false; } const SBuf::size_type wantCapacity = min(Config.maxRequestBufferSize, haveCapacity*2); - in.buf.reserveCapacity(wantCapacity); - debugs(33, 2, "growing request buffer: available=" << in.buf.spaceSize() << " used=" << in.buf.length()); + buf.reserveCapacity(wantCapacity); + debugs(33, 2, "growing request buffer: available=" << buf.spaceSize() << " used=" << buf.length()); } - return (in.buf.spaceSize() >= 2); + return (buf.spaceSize() >= 2); } void diff --git a/src/client_side.h b/src/client_side.h index 6531a68095..ddd6901b90 100644 --- a/src/client_side.h +++ b/src/client_side.h @@ -195,7 +195,6 @@ public: /// Traffic parsing bool clientParseRequests(); void readNextRequest(); - bool maybeMakeSpaceAvailable(); ClientSocketContext::Pointer getCurrentContext() const; void addContextToQueue(ClientSocketContext * context); int getConcurrentRequestCount() const; @@ -211,6 +210,7 @@ public: struct In { In(); ~In(); + bool maybeMakeSpaceAvailable(); ChunkedCodingParser *bodyParser; ///< parses chunked request body SBuf buf; diff --git a/src/tests/stub_client_side.cc b/src/tests/stub_client_side.cc index 04cf52a9aa..f2173d0ced 100644 --- a/src/tests/stub_client_side.cc +++ b/src/tests/stub_client_side.cc @@ -34,7 +34,6 @@ void ConnStateData::freeAllContexts() STUB void ConnStateData::notifyAllContexts(const int xerrno) STUB bool ConnStateData::clientParseRequests() STUB_RETVAL(false) void ConnStateData::readNextRequest() STUB -bool ConnStateData::maybeMakeSpaceAvailable() STUB_RETVAL(false) void ConnStateData::addContextToQueue(ClientSocketContext * context) STUB int ConnStateData::getConcurrentRequestCount() const STUB_RETVAL(0) bool ConnStateData::isOpen() const STUB_RETVAL(false) @@ -74,6 +73,8 @@ void ConnStateData::buildSslCertGenerationParams(Ssl::CertificateProperties &cer bool ConnStateData::serveDelayedError(ClientSocketContext *context) STUB_RETVAL(false) #endif +bool ConnStateData::In::maybeMakeSpaceAvailable() STUB_RETVAL(false) + void setLogUri(ClientHttpRequest * http, char const *uri, bool cleanUrl) STUB const char *findTrailingHTTPVersion(const char *uriAndHTTPVersion, const char *end) STUB_RETVAL(NULL) int varyEvaluateMatch(StoreEntry * entry, HttpRequest * req) STUB_RETVAL(0)