]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3971: "cannot aggregate mgr:client_list: cmd->profile != NULL" in SMP mode
authorNathan Hoad <nathan@getoffmalawn.com>
Sun, 2 Feb 2014 02:41:49 +0000 (19:41 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 2 Feb 2014 02:41:49 +0000 (19:41 -0700)
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

src/client_db.cc
src/client_db.h
src/main.cc

index fb737b21e73e8507c53c93ba9ab42bbd19746f4d..c24fff51d616085ab222b05cfc590503dbe05dee 100644 (file)
@@ -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)
index 1c10c4caaf1f13b937917794e17e6aadb727b2f1..0d0098ff3e39dc85e40b4f918ffe045d003b9386 100644 (file)
@@ -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 *);
index 7e8ff6ade89efb883119633ca6b7a0c50b0287ae..a6a8b27a74afcf0ddd929724fe468d7e99449a6b 100644 (file)
@@ -700,7 +700,6 @@ serverConnectionsOpen(void)
         snmpOpenPorts();
 #endif
 
-        clientdbInit();
         icmpEngine.Open();
         netdbInit();
         asnInit();