From: Kinkie Date: Fri, 4 Jul 2008 03:00:36 +0000 (+0200) Subject: Refactored shutdown command from legacy-style to object-style X-Git-Tag: SQUID_3_1_0_1~49^2~143^2~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e7ece51e2441144d91f54a4f800ef6e46626772;p=thirdparty%2Fsquid.git Refactored shutdown command from legacy-style to object-style --- diff --git a/src/CacheManager.h b/src/CacheManager.h index f2c18b590d..b590f7a07a 100644 --- a/src/CacheManager.h +++ b/src/CacheManager.h @@ -72,6 +72,7 @@ public: class CacheManagerShutdownAction : public CacheManagerAction { public: virtual void run (StoreEntry *sentry); + CacheManagerShutdownAction(); }; class CacheManagerActionList : public Vector { @@ -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); diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 2445818d12..55d98b6846 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -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