namespace Comm {
-/** COMM flags */
-/* TODO: make these a struct of boolean flags in connection instead of a bitmap. */
+/* TODO: make these a struct of boolean flags members in the connection instead of a bitmap.
+ * we can't do that until all non-comm code uses Commm::Connection objects to create FD
+ * currently there is code still using comm_open() and comm_openex() synchronously!!
+ */
#define COMM_UNSET 0x00
#define COMM_NONBLOCKING 0x01
#define COMM_NOCLOEXEC 0x02
{
FwdServer *fs = psstate->servers;
- // TODO enforce Config.forward_max_tries and/or Config.retry.maxtries
- // the maximum number of paths we are allowed to try...
-
// convert the list of FwdServer destinations into destinations IP addresses
- if (fs) {
+ if (fs && psstate->paths->size() < Config.forward_max_tries) {
// send the next one off for DNS lookup.
const char *host = fs->_peer ? fs->_peer->host : psstate->request->GetHost();
debugs(44, 2, "Find IP destination for: " << psstate->entry->url() << "' via " << host);
for (int n = 0; n < ia->count; n++, ip++) {
if (ip >= ia->count) ip = 0; // looped back to zero.
+ // Enforce forward_max_tries configuration.
+ if (psstate->paths->paths() >= Config.forward_max_tries)
+ break;
+
// for TPROXY we must skip unusable addresses.
if (psstate->request->flags.spoof_client_ip && !(fs->_peer && fs->_peer->options.no_tproxy) ) {
if(ia->in_addrs[n].IsIPv4() != psstate->request->client_addr.IsIPv4()) {
// resolve the possible peers
peerSelectDnsPaths(ps);
-// DEAD? peerSelectCallback(ps);
}
int peerAllowedToUse(const peer * p, HttpRequest * request);