about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-04-18 16:48:03 -0700
committerEric Wong <normalperson@yhbt.net>2012-04-18 17:13:17 -0700
commitab61cee92d1c263149ca3c6bc5ce275c96951068 (patch)
treec57d710fc66f2e8bbbea87a20e7ba53d6cb3cfb2
parent2b519f55f60125c1a753916c301b328c803f013c (diff)
downloadcmogstored-ab61cee92d1c263149ca3c6bc5ce275c96951068.tar.gz
Some folks may want to test cmogstored as a GET-only HTTP
server and leave certain functionality to the original Perl
mogstored.
-rw-r--r--cmogstored.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmogstored.c b/cmogstored.c
index a0944cb..c71655a 100644
--- a/cmogstored.c
+++ b/cmogstored.c
@@ -13,6 +13,7 @@ const char *argp_program_version = THIS" "PACKAGE_VERSION;
 static sig_atomic_t sigchld_nr;
 static sig_atomic_t do_exit;
 static size_t nthr;
+static bool have_mgmt;
 static unsigned long worker_processes;
 static Hash_table *workers;
 struct worker {
@@ -289,6 +290,7 @@ static bool svc_start_each(void *svcptr, void *qptr)
         svc->queue = q;
 
         if (svc->mgmt_fd >= 0) {
+                have_mgmt = true;
                 ac = mog_accept_init(svc->mgmt_fd, svc, mog_mgmt_post_accept);
 
                 /*
@@ -424,7 +426,7 @@ static void main_loop(const pid_t parent)
                 mog_notify_wait();
                 if (do_exit)
                         cmogstored_exit();
-                if (sigchld_nr > 0) {
+                if (have_mgmt && sigchld_nr > 0) {
                         mog_mnt_refresh();
                         mog_iostat_spawn();
                         sigchld_nr = 0;
@@ -442,8 +444,10 @@ static void run_worker(const pid_t parent)
         mog_notify_init();
         siginit(worker_wakeup_handler);
         mog_thrpool_start(&q->thrpool, nthr, mog_queue_loop, q);
-        mog_svc_each(svc_start_each, q);
-        mog_iostat_spawn();
+        have_mgmt = false;
+        mog_svc_each(svc_start_each, q); /* this will set have_mgmt */
+        if (have_mgmt)
+                mog_iostat_spawn();
         main_loop(parent);
 }