]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Refactored shutdown command from legacy-style to object-style
authorKinkie <kinkie@squid-cache.org>
Fri, 4 Jul 2008 03:00:36 +0000 (05:00 +0200)
committerKinkie <kinkie@squid-cache.org>
Fri, 4 Jul 2008 03:00:36 +0000 (05:00 +0200)
src/CacheManager.h
src/cache_manager.cc

index f2c18b590db99f95d2d4ae67d27ba233eb75fc6e..b590f7a07a64367905d230a6c926af645af5e8db 100644 (file)
@@ -72,6 +72,7 @@ public:
 class CacheManagerShutdownAction : public CacheManagerAction {
 public:
      virtual void run (StoreEntry *sentry);
+     CacheManagerShutdownAction();
 };
 
 class CacheManagerActionList : public Vector<CacheManagerAction *> {
@@ -130,7 +131,6 @@ private:
     //via the singleton, but it's syntactic hackery
     //TODO: fix so that ActionTable uses a Command pattern and thus
     //      function calls are properly object-wrapped
-    static void ShutdownCommand(StoreEntry *unused);
     static void ReconfigureCommand(StoreEntry *sentry);
     static void MenuCommand(StoreEntry *sentry);
     static void OfflineToggleCommand(StoreEntry *sentry);
index 2445818d12bbc68d3bb57febab86b030e3be6efa..55d98b6846c443fe901be8d5bf73e7c958d88db3 100644 (file)
@@ -61,15 +61,13 @@ CacheManager::CacheManager()
          delete(ActionsList); //TODO: Laaazy. Will be moved to class member
     ActionsList = new CacheManagerActionList;
     registerAction("menu", "This Cachemanager Menu", MenuCommand, 0, 1);
-    registerAction("shutdown",
-                   "Shut Down the Squid Process",
-                   ShutdownCommand, 1, 1);
     registerAction("reconfigure",
                      "Reconfigure the Squid Process",
                      ReconfigureCommand, 1, 1);
     registerAction("offline_toggle",
                    "Toggle offline_mode setting",
                    OfflineToggleCommand, 1, 1);
+    registerAction(new CacheManagerShutdownAction);
 }
 
 void
@@ -339,18 +337,12 @@ CacheManager::Start(int fd, HttpRequest * request, StoreEntry * entry)
     StateFree(mgr);
 }
 
-/// \ingroup CacheManagerInternal
-void
-CacheManager::ShutdownCommand(StoreEntry *unused)
-{
-    debugs(16, 0, "Shutdown by command.");
-    shut_down(0);
-}
 void CacheManagerShutdownAction::run(StoreEntry *sentry)
 {
     debugs(16, 0, "Shutdown by command.");
     shut_down(0);
 }
+CacheManagerShutdownAction::CacheManagerShutdownAction() : CacheManagerAction("shutdown","Shut Down the Squid Process", 1, 1) { }
 
 /// \ingroup CacheManagerInternal
 void