yuri r7627 - in trunk/OpenDNSSEC/enforcer-ng/src: . daemon enforcer policy

commits at svn.opendnssec.org commits at svn.opendnssec.org
Thu Feb 6 16:53:49 CET 2014


Author: yuri
Date: Thu Feb  6 16:53:49 2014
New Revision: 7627
URL: http://fisheye.opendnssec.org/changelog/opendnssec?cs=7627

Log:
code deduplication and some code that should've been in previous commit...

Modified:
   trunk/OpenDNSSEC/enforcer-ng/src/Makefile.am
   trunk/OpenDNSSEC/enforcer-ng/src/daemon/engine.c
   trunk/OpenDNSSEC/enforcer-ng/src/daemon/engine.h
   trunk/OpenDNSSEC/enforcer-ng/src/enforcer/setup_cmd.cpp
   trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_all_cmd.cpp
   trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_conf_cmd.cpp
   trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_repositorylist_cmd.cpp
   trunk/OpenDNSSEC/enforcer-ng/src/ods-enforcerd.c
   trunk/OpenDNSSEC/enforcer-ng/src/policy/policy_import_cmd.cpp
   trunk/OpenDNSSEC/enforcer-ng/src/policy/update_kasp_cmd.cpp

Modified: trunk/OpenDNSSEC/enforcer-ng/src/Makefile.am
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/Makefile.am	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/Makefile.am	Thu Feb  6 16:53:49 2014	(r7627)
@@ -129,6 +129,8 @@
 	enforcer/enforcer.cpp enforcer/enforcer.h \
 	enforcer/enforcerzone.cpp enforcer/enforcerzone.h \
 	enforcer/hsmkeyfactory.cpp enforcer/hsmkeyfactory.h \
+	enforcer/update_conf_cmd.cpp enforcer/update_conf_cmd.h \
+	enforcer/update_conf_task.cpp enforcer/update_conf_task.h \
 	enforcer/update_repositorylist_cmd.cpp enforcer/update_repositorylist_cmd.h \
 	enforcer/update_repositorylist_task.cpp enforcer/update_repositorylist_task.h \
 	enforcer/update_all_cmd.cpp enforcer/update_all_cmd.h \

Modified: trunk/OpenDNSSEC/enforcer-ng/src/daemon/engine.c
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/daemon/engine.c	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/daemon/engine.c	Thu Feb  6 16:53:49 2014	(r7627)
@@ -768,3 +768,19 @@
     allocator_cleanup(allocator);
     return;
 }
+
+void
+flush_all_tasks(int sockfd, engine_type* engine)
+{
+    ods_log_debug("[%s] flushing all tasks...", engine_str);
+    ods_printf(sockfd,"flushing all tasks...\n");
+
+    ods_log_assert(engine);
+    ods_log_assert(engine->taskq);
+    lock_basic_lock(&engine->taskq->schedule_lock);
+    /* [LOCK] schedule */
+    schedule_flush(engine->taskq, TASK_NONE);
+    /* [UNLOCK] schedule */
+    lock_basic_unlock(&engine->taskq->schedule_lock);
+    engine_wakeup_workers(engine);
+}

Modified: trunk/OpenDNSSEC/enforcer-ng/src/daemon/engine.h
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/daemon/engine.h	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/daemon/engine.h	Thu Feb  6 16:53:49 2014	(r7627)
@@ -146,6 +146,14 @@
  */
 void engine_cleanup(engine_type* engine);
 
+/**
+ * Set all task to immediate execution and wake up all workers.
+ * \param[in] sockfd fd to print to user
+ * \param[in] engine engine
+ *
+ */
+void flush_all_tasks(int sockfd, engine_type* engine);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/OpenDNSSEC/enforcer-ng/src/enforcer/setup_cmd.cpp
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/enforcer/setup_cmd.cpp	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/enforcer/setup_cmd.cpp	Thu Feb  6 16:53:49 2014	(r7627)
@@ -126,22 +126,6 @@
 	return ok;
 }
 
-static void
-flush_all_tasks(int sockfd, engine_type* engine)
-{
-    ods_log_debug("[%s] flushing all tasks...", module_str);
-    ods_printf(sockfd,"flushing all tasks...\n");
-    
-    ods_log_assert(engine);
-    ods_log_assert(engine->taskq);
-    lock_basic_lock(&engine->taskq->schedule_lock);
-    /* [LOCK] schedule */
-    schedule_flush(engine->taskq, TASK_NONE);
-    /* [UNLOCK] schedule */
-    lock_basic_unlock(&engine->taskq->schedule_lock);
-    engine_wakeup_workers(engine);
-}
-
 /**
  * Handle the 'setup' command.
  *

Modified: trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_all_cmd.cpp
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_all_cmd.cpp	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_all_cmd.cpp	Thu Feb  6 16:53:49 2014	(r7627)
@@ -67,22 +67,6 @@
 	);
 }
 
-static void
-flush_all_tasks(int sockfd, engine_type* engine)
-{
-	ods_log_debug("[%s] flushing all tasks...", module_str);
-	ods_printf(sockfd,"flushing all tasks...\n");
-
-	ods_log_assert(engine);
-	ods_log_assert(engine->taskq);
-	lock_basic_lock(&engine->taskq->schedule_lock);
-	/* [LOCK] schedule */
-	schedule_flush(engine->taskq, TASK_NONE);
-	/* [UNLOCK] schedule */
-	lock_basic_unlock(&engine->taskq->schedule_lock);
-	engine_wakeup_workers(engine);
-}
-
 int
 handled_update_all_cmd(int sockfd, engine_type* engine, const char *cmd,
 	ssize_t n)

Modified: trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_conf_cmd.cpp
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_conf_cmd.cpp	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_conf_cmd.cpp	Thu Feb  6 16:53:49 2014	(r7627)
@@ -47,22 +47,6 @@
 		"update repositorylist  FIXME\n");
 }
 
-static void
-flush_all_tasks(int sockfd, engine_type* engine)
-{
-	ods_log_debug("[%s] flushing all tasks...", module_str);
-	ods_printf(sockfd,"flushing all tasks...\n");
-
-	ods_log_assert(engine);
-	ods_log_assert(engine->taskq);
-	lock_basic_lock(&engine->taskq->schedule_lock);
-	/* [LOCK] schedule */
-	schedule_flush(engine->taskq, TASK_NONE);
-	/* [UNLOCK] schedule */
-	lock_basic_unlock(&engine->taskq->schedule_lock);
-	engine_wakeup_workers(engine);
-}
-
 int
 handled_update_conf_cmd(int sockfd, engine_type* engine, 
 	const char *cmd, ssize_t n)

Modified: trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_repositorylist_cmd.cpp
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_repositorylist_cmd.cpp	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/enforcer/update_repositorylist_cmd.cpp	Thu Feb  6 16:53:49 2014	(r7627)
@@ -48,22 +48,6 @@
 		"into the enforcer.\n");
 }
 
-static void
-flush_all_tasks(int sockfd, engine_type* engine)
-{
-	ods_log_debug("[%s] flushing all tasks...", module_str);
-	ods_printf(sockfd,"flushing all tasks...\n");
-
-	ods_log_assert(engine);
-	ods_log_assert(engine->taskq);
-	lock_basic_lock(&engine->taskq->schedule_lock);
-	/* [LOCK] schedule */
-	schedule_flush(engine->taskq, TASK_NONE);
-	/* [UNLOCK] schedule */
-	lock_basic_unlock(&engine->taskq->schedule_lock);
-	engine_wakeup_workers(engine);
-}
-
 int
 handled_update_repositorylist_cmd(int sockfd, engine_type* engine, 
 	const char *cmd, ssize_t n)

Modified: trunk/OpenDNSSEC/enforcer-ng/src/ods-enforcerd.c
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/ods-enforcerd.c	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/ods-enforcerd.c	Thu Feb  6 16:53:49 2014	(r7627)
@@ -38,6 +38,7 @@
 /* Pull in the commands that have been implemented for the enforcer */
 #include "enforcer/autostart_cmd.h"
 #include "enforcer/setup_cmd.h"
+#include "enforcer/update_conf_cmd.h"
 #include "enforcer/update_repositorylist_cmd.h"
 #include "enforcer/update_all_cmd.h"
 

Modified: trunk/OpenDNSSEC/enforcer-ng/src/policy/policy_import_cmd.cpp
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/policy/policy_import_cmd.cpp	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/policy/policy_import_cmd.cpp	Thu Feb  6 16:53:49 2014	(r7627)
@@ -52,22 +52,6 @@
 			   "policy import          Import policies from kasp.xml into the enforcer database.\n");
 }
 
-static void
-flush_all_tasks(int sockfd, engine_type* engine)
-{
-    ods_log_debug("[%s] flushing all tasks...", module_str);
-    ods_printf(sockfd,"flushing all tasks...\n");
-    
-    ods_log_assert(engine);
-    ods_log_assert(engine->taskq);
-    lock_basic_lock(&engine->taskq->schedule_lock);
-    /* [LOCK] schedule */
-    schedule_flush(engine->taskq, TASK_NONE);
-    /* [UNLOCK] schedule */
-    lock_basic_unlock(&engine->taskq->schedule_lock);
-    engine_wakeup_workers(engine);
-}
-
 int
 handled_policy_import_cmd(int sockfd, engine_type* engine, const char *cmd,
                         ssize_t n)

Modified: trunk/OpenDNSSEC/enforcer-ng/src/policy/update_kasp_cmd.cpp
==============================================================================
--- trunk/OpenDNSSEC/enforcer-ng/src/policy/update_kasp_cmd.cpp	Thu Feb  6 16:40:34 2014	(r7626)
+++ trunk/OpenDNSSEC/enforcer-ng/src/policy/update_kasp_cmd.cpp	Thu Feb  6 16:53:49 2014	(r7627)
@@ -52,22 +52,6 @@
 		" kasp.xml into the enforcer.\n");
 }
 
-static void
-flush_all_tasks(int sockfd, engine_type* engine)
-{
-	ods_log_debug("[%s] flushing all tasks...", module_str);
-	ods_printf(sockfd,"flushing all tasks...\n");
-
-	ods_log_assert(engine);
-	ods_log_assert(engine->taskq);
-	lock_basic_lock(&engine->taskq->schedule_lock);
-	/* [LOCK] schedule */
-	schedule_flush(engine->taskq, TASK_NONE);
-	/* [UNLOCK] schedule */
-	lock_basic_unlock(&engine->taskq->schedule_lock);
-	engine_wakeup_workers(engine);
-}
-
 int
 handled_update_kasp_cmd(int sockfd, engine_type* engine, 
 	const char *cmd, ssize_t n)



More information about the Opendnssec-commits mailing list