]> code.citadel.org Git - citadel.git/blobdiff - citadel/server_main.c
* The scheduler can now "wake up" a session to deliver async messages.
[citadel.git] / citadel / server_main.c
index e2872df5d70a8b14ada4096c2564e24764aa42ab..a5199b19fc840920751a1e0561316c368286150d 100644 (file)
@@ -40,6 +40,9 @@
 #ifdef HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
 #include "citadel.h"
 #include "server.h"
 #include "serv_extensions.h"
@@ -170,7 +173,8 @@ int main(int argc, char **argv)
        CtdlRegisterServiceHook(0,
                                "citadel.socket",
                                citproto_begin_session,
-                               do_command_loop);
+                               do_command_loop,
+                               do_async_loop);
 
        /*
         * Bind the server to our favorite TCP port (usually 504).
@@ -178,7 +182,8 @@ int main(int argc, char **argv)
        CtdlRegisterServiceHook(config.c_port_number,
                                NULL,
                                citproto_begin_session,
-                               do_command_loop);
+                               do_command_loop,
+                               do_async_loop);
 
        /*
         * Load any server-side extensions available here.
@@ -187,19 +192,6 @@ int main(int argc, char **argv)
        size = strlen(bbs_home_directory) + 9;
        initialize_server_extensions();
 
-       /*
-        * The rescan pipe exists so that worker threads can be woken up and
-        * told to re-scan the context list for fd's to listen on.  This is
-        * necessary, for example, when a context is about to go idle and needs
-        * to get back on that list.
-        */
-       if (pipe(rescan)) {
-               lprintf(CTDL_EMERG, "Can't create rescan pipe!\n");
-               exit(errno);
-       }
-
-       init_master_fdset();
-
        /*
         * Now that we've bound the sockets, change to the BBS user id and its
         * corresponding group ids
@@ -219,6 +211,9 @@ int main(int argc, char **argv)
                if (setuid(BBSUID) != 0) {
                        lprintf(CTDL_CRIT, "setuid() failed: %s\n", strerror(errno));
                }
+#if defined (HAVE_SYS_PRCTL_H) && defined (PR_SET_DUMPABLE)
+               prctl(PR_SET_DUMPABLE, 1);
+#endif
        }
 
        /* We want to check for idle sessions once per minute */
@@ -256,6 +251,5 @@ int main(int argc, char **argv)
        end_critical_section(S_WORKER_LIST);
 
        master_cleanup();
-
        return(0);
 }