From: Amos Jeffries Date: Mon, 4 Mar 2013 20:16:37 +0000 (-0700) Subject: Bug 3673: Silence 'Failed to select source' messages X-Git-Tag: SQUID_3_3_3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22d6442e57db8269524083f291a216ed52d3e944;p=thirdparty%2Fsquid.git Bug 3673: Silence 'Failed to select source' messages --- diff --git a/src/PeerSelectState.h b/src/PeerSelectState.h index 6823bb7533..1e694c8e28 100644 --- a/src/PeerSelectState.h +++ b/src/PeerSelectState.h @@ -73,6 +73,11 @@ class ps_state public: void *operator new(size_t); ps_state(); + + // Produce a URL for display identifying the transaction we are + // trying to locate a peer for. + const char * url() const; + HttpRequest *request; StoreEntry *entry; allow_t always_direct; diff --git a/src/peer_select.cc b/src/peer_select.cc index add3165ac9..bb978e05df 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -55,6 +55,7 @@ #include "SquidConfig.h" #include "SquidTime.h" #include "Store.h" +#include "URL.h" static struct { int timeouts; @@ -285,15 +286,10 @@ peerSelectDnsPaths(ps_state *psstate) PSC *callback = psstate->callback; psstate->callback = NULL; - if (psstate->paths->size() < 1) { - debugs(44, DBG_IMPORTANT, "Failed to select source for '" << psstate->entry->url() << "'"); - debugs(44, DBG_IMPORTANT, " always_direct = " << psstate->always_direct); - debugs(44, DBG_IMPORTANT, " never_direct = " << psstate->never_direct); - debugs(44, DBG_IMPORTANT, " timedout = " << psstate->ping.timedout); - } else { - debugs(44, 2, "Found sources for '" << psstate->entry->url() << "'"); - debugs(44, 2, " always_direct = " << psstate->always_direct); - debugs(44, 2, " never_direct = " << psstate->never_direct); + debugs(44, 2, (psstate->paths->size()<1?"Failed to select source":"Found sources") << " for '" << psstate->url() << "'"); + debugs(44, 2, " always_direct = " << psstate->always_direct); + debugs(44, 2, " never_direct = " << psstate->never_direct); + if (psstate->paths) { for (size_t i = 0; i < psstate->paths->size(); ++i) { if ((*psstate->paths)[i]->peerType == HIER_DIRECT) debugs(44, 2, " DIRECT = " << (*psstate->paths)[i]); @@ -304,8 +300,8 @@ peerSelectDnsPaths(ps_state *psstate) else debugs(44, 2, " cache_peer = " << (*psstate->paths)[i]); } - debugs(44, 2, " timedout = " << psstate->ping.timedout); } + debugs(44, 2, " timedout = " << psstate->ping.timedout); psstate->ping.stop = current_time; psstate->request->hier.ping = psstate->ping; @@ -971,6 +967,18 @@ ps_state::ps_state() : request (NULL), ; // no local defaults. } +const char * +ps_state::url() const +{ + if (entry) + return entry->url(); + + if (request) + return urlCanonical(request); + + return "[no URL]"; +} + ping_data::ping_data() : n_sent(0), n_recv(0),