]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
mem_hdr::hasContigousContentRange() should return true for empty ranges
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 15 Feb 2013 18:12:40 +0000 (11:12 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 15 Feb 2013 18:12:40 +0000 (11:12 -0700)
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.

src/stmem.cc

index 1465a9fbe770a1777227767bd3eb37d972404857..071584c0491b43c2bbe7bfac22b415203bdb3114 100644 (file)
@@ -313,7 +313,7 @@ mem_hdr::hasContigousContentRange(Range<int64_t> const & range) const
             return true;
     }
 
-    return false;
+    return !range.size(); // empty range is contigous
 }
 
 bool