From: Francesco Chemolli Date: Wed, 9 Jul 2008 14:00:01 +0000 (+0200) Subject: Refactored actions "server_list" and "non_peer" to Cache Manager singleton API. X-Git-Tag: SQUID_3_1_0_1~49^2~143^2~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ea8b120656226152cb115c58342665c0c21eb9f;p=thirdparty%2Fsquid.git Refactored actions "server_list" and "non_peer" to Cache Manager singleton API. --- diff --git a/src/main.cc b/src/main.cc index 72999d2d49..7d4cb60887 100644 --- a/src/main.cc +++ b/src/main.cc @@ -731,7 +731,7 @@ mainReconfigure(void) serverConnectionsOpen(); neighbors_init(); - neighborsRegisterWithCacheManager(*manager); + neighborsRegisterWithCacheManager(); storeDirOpenSwapLogs(); @@ -1055,7 +1055,7 @@ mainInitialize(void) neighbors_init(); - neighborsRegisterWithCacheManager(*manager); + neighborsRegisterWithCacheManager(); if (Config.chroot_dir) no_suid(); diff --git a/src/neighbors.cc b/src/neighbors.cc index ed318d93d4..0eaf23707f 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -550,25 +550,18 @@ neighbors_init(void) } void -neighborsRegisterWithCacheManager(CacheManager & manager) +neighborsRegisterWithCacheManager() { - manager.registerAction("server_list", + CacheManager *manager = CacheManager::GetInstance(); + manager->registerAction("server_list", "Peer Cache Statistics", neighborDumpPeers, 0, 1); if (theInIcpConnection >= 0) { - manager.registerAction("non_peers", + manager->registerAction("non_peers", "List of Unknown sites sending ICP messages", neighborDumpNonPeers, 0, 1); } - - /* XXX FIXME: unregister if we were registered. Something like: - * else { - * CacheManagerAction * action = manager.findAction("non_peers"); - * if (action != NULL) - * manager.unregisterAction(action); - * } - */ } int diff --git a/src/protos.h b/src/protos.h index f91473f46d..a5362ee30f 100644 --- a/src/protos.h +++ b/src/protos.h @@ -391,7 +391,7 @@ SQUIDCEXTERN void neighborAddAcl(const char *, const char *); SQUIDCEXTERN void neighborsUdpAck(const cache_key *, icp_common_t *, const IPAddress &); SQUIDCEXTERN void neighborAdd(const char *, const char *, int, int, int, int, int); SQUIDCEXTERN void neighbors_init(void); -extern void neighborsRegisterWithCacheManager(CacheManager & manager); +extern void neighborsRegisterWithCacheManager(); SQUIDCEXTERN peer *peerFindByName(const char *); SQUIDCEXTERN peer *peerFindByNameAndPort(const char *, unsigned short); SQUIDCEXTERN peer *getDefaultParent(HttpRequest * request);