From: Nathan Hoad Date: Thu, 23 Jan 2014 07:59:26 +0000 (+0200) Subject: Bug 3971: "BUG: cannot aggregate mgr:client_list: cmd->profile != NULL" in SMP mode X-Git-Tag: SQUID_3_5_0_1~402 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38e50b3a852779215d6990908b6ab55065220148;p=thirdparty%2Fsquid.git Bug 3971: "BUG: cannot aggregate mgr:client_list: cmd->profile != NULL" in SMP mode When running Squid in SMP mode, the 'client_list' command cannot be used as the coordinator doesn't call clientdbInit(), and thus doesn't have the client_list action registered. This patch uses RegisteredRunner to initialize clientdb and register the 'client_list' command --- diff --git a/src/client_db.cc b/src/client_db.cc index 1f6eb6ebf6..62ceb4cc1a 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -31,6 +31,7 @@ */ #include "squid.h" +#include "base/RunnersRegistry.h" #include "client_db.h" #include "ClientInfo.h" #include "event.h" @@ -112,22 +113,28 @@ clientdbAdd(const Ip::Address &addr) } static void -clientdbRegisterWithCacheManager(void) -{ - Mgr::RegisterAction("client_list", "Cache Client List", clientdbDump, 0, 1); -} - -void clientdbInit(void) { - clientdbRegisterWithCacheManager(); - if (client_table) return; client_table = hash_create((HASHCMP *) strcmp, CLIENT_DB_HASH_SIZE, hash_string); } +class ClientDbRr: public RegisteredRunner +{ + public: + virtual void run(const RunnerRegistry &); +}; +RunnerRegistrationEntry(rrAfterConfig, ClientDbRr); + +void +ClientDbRr::run(const RunnerRegistry &r) +{ + clientdbInit(); + Mgr::RegisterAction("client_list", "Cache Client List", clientdbDump, 0, 1); +} + #if USE_DELAY_POOLS /* returns ClientInfo for given IP addr Returns NULL if no such client (or clientdb turned off) diff --git a/src/client_db.h b/src/client_db.h index 1c10c4caaf..0d0098ff3e 100644 --- a/src/client_db.h +++ b/src/client_db.h @@ -46,7 +46,6 @@ class Address; class StoreEntry; class ClientInfo; -void clientdbInit(void); void clientdbUpdate(const Ip::Address &, LogTags, AnyP::ProtocolType, size_t); int clientdbCutoffDenied(const Ip::Address &); void clientdbDump(StoreEntry *); diff --git a/src/main.cc b/src/main.cc index d72b69b600..5b2852b091 100644 --- a/src/main.cc +++ b/src/main.cc @@ -698,7 +698,6 @@ serverConnectionsOpen(void) snmpOpenPorts(); #endif - clientdbInit(); icmpEngine.Open(); netdbInit(); asnInit();