]> code.citadel.org Git - citadel.git/blobdiff - webcit/webserver.c
* initialize_viewdefs (): call me via the init hook
[citadel.git] / webcit / webserver.c
index e05dffddfa8764e1012a0407306d349f18ba3099..65c812a5f36beb45a9892b7b7b417a3873a7a061 100644 (file)
@@ -22,7 +22,7 @@ int vsnprintf(char *buf, size_t max, const char *fmt, va_list argp);
 extern int msock;                      /* master listening socket */
 extern int verbosity;          /* Logging level */
 extern char static_icon_dir[PATH_MAX];          /* where should we find our mime icons */
-
+extern long MaxRead; 
 int is_https = 0;              /* Nonzero if I am an HTTPS service */
 int follow_xff = 0;            /* Follow X-Forwarded-For: header */
 int home_specified = 0;                /* did the user specify a homedir? */
@@ -77,7 +77,7 @@ int main(int argc, char **argv)
        size_t basesize = 2;            /* how big should strbufs be on creation? */
        pthread_t SessThread;           /* Thread descriptor */
        pthread_attr_t attr;            /* Thread attributes */
-       int a, i;                       /* General-purpose variables */
+       int a;                          /* General-purpose variable */
        char tracefile[PATH_MAX];
        char ip_addr[256]="0.0.0.0";
        int relh=0;
@@ -114,9 +114,9 @@ int main(int argc, char **argv)
 
        /* Parse command line */
 #ifdef HAVE_OPENSSL
-       while ((a = getopt(argc, argv, "u:h:i:p:t:T:B:x:dD:G:cfsS:Z")) != EOF)
+       while ((a = getopt(argc, argv, "R:u:h:i:p:t:T:B:x:dD:G:cfsS:Z")) != EOF)
 #else
-       while ((a = getopt(argc, argv, "u:h:i:p:t:T:B:x:dD:G:cfZ")) != EOF)
+       while ((a = getopt(argc, argv, "R:u:h:i:p:t:T:B:x:dD:G:cfZ")) != EOF)
 #endif
                switch (a) {
                case 'u':
@@ -205,6 +205,9 @@ int main(int argc, char **argv)
                        I18nDump = NewStrBufPlain(HKEY("int templatestrings(void)\n{\n"));
                        I18nDumpFile = optarg;
                        break;
+               case 'R':
+                       MaxRead = atol(optarg);
+                       break;
                default:
                        fprintf(stderr, "usage: webcit "
                                "[-i ip_addr] [-p http_port] "
@@ -229,6 +232,7 @@ int main(int argc, char **argv)
                start_daemon(pidfile);
        }
        else {
+               signal(SIGINT, graceful_shutdown);
                signal(SIGHUP, graceful_shutdown);
        }
 
@@ -246,7 +250,6 @@ int main(int argc, char **argv)
        /* initialize the International Bright Young Thing */
 
        initialise_modules();
-       initialize_viewdefs();
        initialize_axdefs();
 
        InitTemplateCache();
@@ -255,7 +258,7 @@ int main(int argc, char **argv)
                StrBufAppendBufPlain(I18nDump, HKEY("}\n"), 0);
                if (StrLength(I18nDump) < 50) {
                        lprintf(1, "********************************************************************************\n");
-                       lprintf(1, "*        No strings found in templates! are you shure they're there?           *\n");
+                       lprintf(1, "*        No strings found in templates!  Are you sure they're there?           *\n");
                        lprintf(1, "********************************************************************************\n");
                        return -1;
                }
@@ -344,12 +347,7 @@ int main(int argc, char **argv)
 #endif
        drop_root(UID);
 
-       /* Start a few initial worker threads */
-       for (i = 0; i < (MIN_WORKER_THREADS); ++i) {
-               spawn_another_worker_thread();
-       }
-
-       /* now the original thread becomes another worker */
+       /* Become a worker thread.  More worker threads will be spawned as they are needed. */
        worker_entry();
        ShutDownLibCitadel ();
        return 0;