From: Amos Jeffries Date: Fri, 8 Mar 2013 02:15:39 +0000 (-0700) Subject: Bug 3673: Silence 'Failed to select source' messages X-Git-Tag: SQUID_3_2_9~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8b0e3261c60748c7938090f0544540cdca4b5ce;p=thirdparty%2Fsquid.git Bug 3673: Silence 'Failed to select source' messages --- diff --git a/src/PeerSelectState.h b/src/PeerSelectState.h index 639f041a4f..b343d10d08 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 fb3f20d775..6199c97bff 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -48,6 +48,7 @@ #include "icmp/net_db.h" #include "ipcache.h" #include "ip/tools.h" +#include "URL.h" static struct { int timeouts; @@ -289,15 +290,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]); @@ -308,8 +304,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; @@ -977,6 +973,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),