From: Nathan Hoad Date: Sun, 2 Feb 2014 02:41:49 +0000 (-0700) Subject: Bug 3971: "cannot aggregate mgr:client_list: cmd->profile != NULL" in SMP mode X-Git-Tag: SQUID_3_4_3~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=811dc8693a5c69e682def42148cd01bfaa9ec9e3;p=thirdparty%2Fsquid.git Bug 3971: "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 fb737b21e7..c24fff51d6 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 "event.h" #include "format/Token.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 7e8ff6ade8..a6a8b27a74 100644 --- a/src/main.cc +++ b/src/main.cc @@ -700,7 +700,6 @@ serverConnectionsOpen(void) snmpOpenPorts(); #endif - clientdbInit(); icmpEngine.Open(); netdbInit(); asnInit();