about summary refs log tree commit homepage
path: root/cmogstored.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-01-24 03:28:51 +0000
committerEric Wong <normalperson@yhbt.net>2013-01-31 02:10:38 +0000
commit80aef1b3c8e9a20ec047dcf040e594a5e2a23811 (patch)
treeba893dfb1776dddc8f716d89533a527828a81660 /cmogstored.c
parent25d7a82d9851c204e6ca47ab8af35fdab9bbd37c (diff)
downloadcmogstored-80aef1b3c8e9a20ec047dcf040e594a5e2a23811.tar.gz
No need to clutter up the main file with graceful exit
functionality.
Diffstat (limited to 'cmogstored.c')
-rw-r--r--cmogstored.c46
1 files changed, 1 insertions, 45 deletions
diff --git a/cmogstored.c b/cmogstored.c
index efe5f2b..b21f20f 100644
--- a/cmogstored.c
+++ b/cmogstored.c
@@ -5,6 +5,7 @@
 #include "cmogstored.h"
 #include "cfg.h"
 #include "nostd/setproctitle.h"
+_Noreturn void cmogstored_exit(void);
 #define THIS "cmogstored"
 #define DESC "alternative mogstored implementation for MogileFS"
 static char summary[] = THIS " -- "DESC;
@@ -308,51 +309,6 @@ static bool svc_start_each(void *svcptr, void *qptr)
         return true;
 }
 
-static void acceptor_quit(int fd)
-{
-        if (fd >= 0) {
-                struct mog_fd *mfd = mog_fd_get(fd);
-                struct mog_accept *ac = &mfd->as.accept;
-
-                mog_thrpool_quit(&ac->thrpool, NULL);
-                mog_fd_put(mfd);
-        }
-}
-
-static bool svc_quit_accept_i(void *svcptr, void *ignored)
-{
-        struct mog_svc *svc = svcptr;
-
-        acceptor_quit(svc->mgmt_fd);
-        acceptor_quit(svc->http_fd);
-        acceptor_quit(svc->httpget_fd);
-
-        return true;
-}
-
-static bool svc_queue_set(void *svcptr, void *queue)
-{
-        struct mog_svc *svc = svcptr;
-
-        svc->queue = queue;
-
-        return true;
-}
-
-_Noreturn static void cmogstored_exit(void)
-{
-        /* call atexit() handlers and make valgrind happy */
-        setproctitle("cmogstored, shutting down");
-        mog_svc_each(svc_quit_accept_i, NULL);
-        mog_svc_dev_shutdown();
-        mog_queue_stop(mog_notify_queue);
-        mog_svc_dev_shutdown();
-        mog_svc_each(svc_queue_set, mog_notify_queue);
-        mog_fdmap_requeue(mog_notify_queue);
-        mog_queue_quit_loop(mog_notify_queue);
-        exit(EXIT_SUCCESS);
-}
-
 static void worker_wakeup_handler(int signum)
 {
         switch (signum) {