From: Alex Rousskov Date: Fri, 15 Feb 2013 18:12:40 +0000 (-0700) Subject: mem_hdr::hasContigousContentRange() should return true for empty ranges X-Git-Tag: SQUID_3_5_0_1~444^2~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cc44692ae5ad980e1f8474544e79886d5695257;p=thirdparty%2Fsquid.git mem_hdr::hasContigousContentRange() should return true for empty ranges mem_hdr::hasContigousContentRange() is called exclusively from StoreEntry::mayStartSwapOut() via memObject::isContiguous(). In theory, that mayStartSwapOut() may happen when we have not written anything to mem_hdr yet (not even HTTP response headers). In that case, mayStartSwapout() should not refuse to swap the entry out on non-contiguous grounds, but it was doing that because hasContigousContentRange() mishandled the empty range case. XXX: Calling hasContigousContentRange() [just] from mayStartSwapout() is just wrong because what may be contiguous now may become fragmented later. --- diff --git a/src/stmem.cc b/src/stmem.cc index 1465a9fbe7..071584c049 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -313,7 +313,7 @@ mem_hdr::hasContigousContentRange(Range const & range) const return true; } - return false; + return !range.size(); // empty range is contigous } bool