Skip to content

Commit

Permalink
fixup: Removed out-of-scope improvements
Browse files Browse the repository at this point in the history
These should probably wait until we resume official PR #736 (i.e. old
Factory branch SQUID-533-Optimize-memalloc-server-reads) work or start
pushing tiny minimal PRs in preparation for that.
  • Loading branch information
rousskov committed Oct 29, 2023
1 parent 78b08ec commit 0aa4317
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 0 additions & 2 deletions src/clients/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,6 @@ Client::adjustBodyBytesRead(const int64_t delta)
if (bodyBytesRead < 0)
bodyBytesRead = 0;

debugs(11, 7, bodyBytesRead << '+' << delta << '=' << (bodyBytesRead+delta));

bodyBytesRead += delta; // supports negative and zero deltas

// check for overflows ("infinite" response?) and underflows (a bug)
Expand Down
17 changes: 5 additions & 12 deletions src/http.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1522,9 +1522,8 @@ HttpStateData::processReplyBody()
}

flags.do_next_read = true;
maybeReadVirginBody();
return;
}
break;

case COMPLETE_PERSISTENT_MSG: {
debugs(11, 5, "processReplyBody: COMPLETE_PERSISTENT_MSG from " << serverConnection);
Expand Down Expand Up @@ -1577,8 +1576,7 @@ HttpStateData::processReplyBody()
return;
}

// TODO: Remove "else" after ENTRY_ABORTED handling above to simplify this logic.
assert(!"unreachable code because all ENTRY_ABORTED and persistentConnStatus() outcomes are handled above");
maybeReadVirginBody();
}

bool
Expand Down Expand Up @@ -1638,15 +1636,10 @@ HttpStateData::calcReadBufferCapacityLimit() const
// .value() dereference in NaturalCast() or add/use NaturalCastOrMax().
const auto configurationPreferences = NaturalSum<size_t>(Config.readAheadGap).value_or(SBuf::maxSize);

// TODO: Integrate with flags.headers_parsed, reflect TeChunkedParser
// trailer parsing requirements, and move to parserLookAheadDistance().
const size_t lookAheadMinimum = httpChunkDecoder ? 64 : 0;

// even if we do not need to look ahead, we have to receive data
const size_t progressMinimum = 1;
// TODO: Honor TeChunkedParser look-ahead and trailer parsing requirements
// (when explicit configurationPreferences are set too low).

const auto combinedMaximum = std::max({configurationPreferences, lookAheadMinimum, progressMinimum});
return std::min<size_t>(combinedMaximum, SBuf::maxSize);
return std::min<size_t>(configurationPreferences, SBuf::maxSize);
}

/// The maximum number of virgin reply bytes we may buffer before we violate
Expand Down

0 comments on commit 0aa4317

Please sign in to comment.