]> git.ipfire.org Git - thirdparty/squid.git/commit
fixup: Re-merge FwdState::saveError() and fail() methods into one
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 14 Jul 2021 17:38:36 +0000 (13:38 -0400)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 14 Jul 2021 17:38:36 +0000 (13:38 -0400)
commite2e1ca4f107ea055830c35974db8b4c34bafaea3
tree2c2ba2826c51aecbae6bf43be6efac7dd824c916
parent68117dad59ac1d938e299a676f9465a6a2f3c26a
fixup: Re-merge FwdState::saveError() and fail() methods into one

... undoing branch commit 0523b93, essentially.

AFAICT, the only way a caller can decide whether to call fail() or
saveError() is to somehow know that fail() should only be called for
ERR_ZERO_SIZE_OBJECT errors. That knowledge is hidden inside branch
code. Moreover, that distinction may change in the future without
saveError() callers' knowledge. In other words, today, saveError()
callers are correct, but tomorrow some of them will become wrong because
of changes in cleanupOnFail() that they do not call. Developers
modifying cleanupOnFail() can easily miss the hidden fact that some of
the saveError() callers should be kept in sync with cleanupOnFail().

Besides saving CPU cycles on that trivial ERR_ZERO_SIZE_OBJECT check, I
saw no value in this dangerous split of fail() into fail() and
saveError(). The branch commit 0523b93 message did not help me discover
that value.

However, commit 0523b93 was based on code that already had
doFail()/cleanup() methods that seem unnecessary to the current diff
reader like me. Perhaps the prior existence of those methods implies
that I am missing some other reasons behind that split...
src/FwdState.cc
src/FwdState.h