]> git.ipfire.org Git - thirdparty/squid.git/commit - src/FwdState.h
Retry requests that failed due to a persistent connection race
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 20 Feb 2012 19:10:54 +0000 (12:10 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Mon, 20 Feb 2012 19:10:54 +0000 (12:10 -0700)
commitbc81ee683a44dd004422909b9ffa9bb097998491
tree474f1ead086900324321796b92a40dae3c280edb
parent3227b30211d145832088a223ab542b6ea9ccfd1f
Retry requests that failed due to a persistent connection race
instead of replying with ERR_ZERO_SIZE_OBJECT "Bad Gateway".

The ERR_ZERO_SIZE_OBJECT errors were visible to the client when the
destination had only one address because serverDestinations.shift()
made the list of destination empty and startConnectionOrFail() failed.

When FwdState starts to use a pinned connection, the connection is treated as
an idle persistent connection as far as race detection is concerned.
Currently, pinned connections cannot be reopened, repinned, and retried after
a pconn race. This will change when server-side bumped connections become
pinned.

It felt wrong that a failed serverConn may remain set while we are opening a
new connection so I set it to NULL after a squid-dev discussion indicating
that doing so should be safe.

We also now reset the local port number to zero in case it was set to the
actual source port by ConnOpener or other code working with the previous
connection to the same serverDestinations[0] address, although simple tests
worked (and showed changing source port) without this reset.
src/forward.cc
src/forward.h