]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3971: "BUG: cannot aggregate mgr:client_list: cmd->profile != NULL" in SMP mode
authorNathan Hoad <nathan@getoffmalawn.com>
Thu, 23 Jan 2014 07:59:26 +0000 (09:59 +0200)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Thu, 23 Jan 2014 07:59:26 +0000 (09:59 +0200)
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 1f6eb6ebf64a0df2847cc5610df2ee7216151e01..62ceb4cc1a80c4d180c2359f55d448fdb36814d6 100644 (file)
@@ -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)
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 d72b69b60069ffd6e5b07513f75dfbab1ff03489..5b2852b091678f37e17c4656f64e10ea96a242ef 100644 (file)
@@ -698,7 +698,6 @@ serverConnectionsOpen(void)
         snmpOpenPorts();
 #endif
 
-        clientdbInit();
         icmpEngine.Open();
         netdbInit();
         asnInit();