From b802d2cba206c82848c0c609cb48a940665ab78a Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Sat, 22 Sep 2012 15:26:23 +0200 Subject: [PATCH] renamed domain_ping to CachePeerDomainList and moved to own header file --- src/CachePeer.h | 4 ++-- src/CachePeerDomainList.h | 41 +++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 1 + src/cache_cf.cc | 13 +++++++------ src/neighbors.cc | 9 +++++---- src/structs.h | 9 --------- 6 files changed, 56 insertions(+), 21 deletions(-) create mode 100644 src/CachePeerDomainList.h diff --git a/src/CachePeer.h b/src/CachePeer.h index 83e7505fac..94067ec9e8 100644 --- a/src/CachePeer.h +++ b/src/CachePeer.h @@ -38,7 +38,7 @@ #endif class acl_access; -class domain_ping; +class CachePeerDomainList; class NeighborTypeDomainList; class PeerDigest; @@ -85,7 +85,7 @@ public: #endif unsigned short http_port; - domain_ping *peer_domain; + CachePeerDomainList *peer_domain; NeighborTypeDomainList *typelist; acl_access *access; diff --git a/src/CachePeerDomainList.h b/src/CachePeerDomainList.h new file mode 100644 index 0000000000..050d0e253b --- /dev/null +++ b/src/CachePeerDomainList.h @@ -0,0 +1,41 @@ +#ifndef SQUID_CACHEPEERDOMAINLIST_H_ +#define SQUID_CACHEPEERDOMAINLIST_H_ +/* + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +/// representation of the cache_peer_domain list. POD. +class CachePeerDomainList +{ +public: + char *domain; + bool do_ping; + CachePeerDomainList *next; +}; + +#endif /* SQUID_CACHEPEERDOMAINLIST_H_ */ diff --git a/src/Makefile.am b/src/Makefile.am index fcddd3450d..7ef917f55d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -277,6 +277,7 @@ squid_SOURCES = \ CacheDigest.cc \ cache_manager.cc \ NeighborTypeDomainList.h \ + CachePeerDomainList.h \ CachePeer.h \ CacheManager.h \ carp.h \ diff --git a/src/cache_cf.cc b/src/cache_cf.cc index a58f3602c2..608541d16e 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -42,6 +42,7 @@ #include "base/RunnersRegistry.h" #include "mgr/ActionPasswordList.h" #include "CachePeer.h" +#include "CachePeerDomainList.h" #include "cache_cf.h" #include "ConfigParser.h" #include "CpuAffinityMap.h" @@ -1976,7 +1977,7 @@ peer_type_str(const peer_t type) static void dump_peer(StoreEntry * entry, const char *name, CachePeer * p) { - domain_ping *d; + CachePeerDomainList *d; NeighborTypeDomainList *t; LOCAL_ARRAY(char, xname, 128); @@ -2514,8 +2515,8 @@ parse_hostdomain(void) self_destruct(); while ((domain = strtok(NULL, list_sep))) { - domain_ping *l = NULL; - domain_ping **L = NULL; + CachePeerDomainList *l = NULL; + CachePeerDomainList **L = NULL; CachePeer *p; if ((p = peerFindByName(host)) == NULL) { @@ -2523,11 +2524,11 @@ parse_hostdomain(void) continue; } - l = static_cast(xcalloc(1, sizeof(domain_ping))); - l->do_ping = 1; + l = static_cast(xcalloc(1, sizeof(CachePeerDomainList))); + l->do_ping = true; if (*domain == '!') { /* check for !.edu */ - l->do_ping = 0; + l->do_ping = false; ++domain; } diff --git a/src/neighbors.cc b/src/neighbors.cc index 3b0ac00d4f..73977af2f9 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -35,6 +35,7 @@ #include "anyp/PortCfg.h" #include "CacheDigest.h" #include "CachePeer.h" +#include "CachePeerDomainList.h" #include "comm/Connection.h" #include "comm/ConnOpener.h" #include "event.h" @@ -156,7 +157,7 @@ bool peerAllowedToUse(const CachePeer * p, HttpRequest * request) { - const domain_ping *d = NULL; + const CachePeerDomainList *d = NULL; assert(request != NULL); if (neighborType(p, request) == PEER_SIBLING) { @@ -1163,9 +1164,9 @@ peerDestroy(void *data) if (p == NULL) return; - domain_ping *nl = NULL; + CachePeerDomainList *nl = NULL; - for (domain_ping *l = p->peer_domain; l; l = nl) { + for (CachePeerDomainList *l = p->peer_domain; l; l = nl) { nl = l->next; safe_free(l->domain); xfree(l); @@ -1585,7 +1586,7 @@ dump_peers(StoreEntry * sentry, CachePeer * peers) { CachePeer *e = NULL; char ntoabuf[MAX_IPSTRLEN]; - domain_ping *d = NULL; + CachePeerDomainList *d = NULL; icp_opcode op; int i; diff --git a/src/structs.h b/src/structs.h index c7879b33fb..e9285dccf6 100644 --- a/src/structs.h +++ b/src/structs.h @@ -162,15 +162,6 @@ public: unsigned int sentLastChunk:1; ///< do not try to write last-chunk again }; -// POD -class domain_ping -{ -public: - char *domain; - int do_ping; /* boolean */ - domain_ping *next; -}; - #if USE_SSL struct _sslproxy_cert_sign { int alg; -- 2.47.2