]> git.ipfire.org Git - thirdparty/squid.git/commit
Preserve caller context across ping timeout events (#635)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Thu, 4 Jun 2020 11:23:31 +0000 (11:23 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 5 Jun 2020 12:43:09 +0000 (12:43 +0000)
commit9865de72e47f5b7341f8a0479c4bf92342768b74
tree3ee90d2eeeebe976237447dfdcd017e4a24abd81
parent0cde91ae3564e4b87248193a0cfc2c3dc66071c0
Preserve caller context across ping timeout events (#635)

PeerSelector was losing its transaction context while handling an
event-driven timeout. Also, the old code generating HandlePingTimeout
event was problematic for two reasons:

* it used raw 'this' for cbdata-protected child class. Sooner or later,
  code like this leads to "real" bugs similar to those fixed in ce9bb79,
  38a9f55 / 9e64d84, and 4299f87.

* It (mis)used event API for the transaction-specific purpose.

We created a new "ping timeout service" that keeps at most one
transaction-agnostic event.h timeout at any given time while maintaining
an internal list of transactions awaiting a ping response. Similar
architecture was used for HappyConnOpener helper services.

We rejected the alternative idea of enhancing event API to support
asynchronous calls because event.cc internals were never meant to handle
thousands of concurrently pending transaction-related timeouts on busy
proxies. While it would be possible to enhance those internals as well,
timeout services offer an even better performance, are much easier to
enhance to support timeout reconfigurations, and offer better "Squid
state" debugging.
src/PeerSelectState.h
src/PingData.h
src/SquidTime.h
src/enums.h
src/neighbors.cc
src/peer_select.cc