[svn:mod_parrot] r620 - mod_parrot/trunk/src

[email protected] Sun, 1 Mar 2009 08:23:32 -0800 (PST)
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Sun Mar  1 08:23:30 2009
New Revision: 620

Modified:
   mod_parrot/trunk/src/mod_parrot.c

Log:
fix virtual host interpreter startup (part 1)


Modified: mod_parrot/trunk/src/mod_parrot.c
==============================================================================
--- mod_parrot/trunk/src/mod_parrot.c	(original)
+++ mod_parrot/trunk/src/mod_parrot.c	Sun Mar  1 08:23:30 2009
@@ -924,12 +924,32 @@
     /* now do the same thing with each virtual host */
     for (vs = s->next; vs; vs = vs->next) {
         modparrot_srv_config *vscfg;
+        modparrot_module_config *cfg;
 
         vscfg = ap_get_module_config(vs->module_config, &parrot_module);
         if (!(vscfg->option_flags & MP_OPT_ENABLE)) continue;
 
         MP_TRACE_h(s, "in modparrot_meta_open_logs_handler (s=%p)", vs);
 
+        /* we duplicate some efforts here because we only find out about
+         * named context pools configured from an HLL when we're already in
+         * that HLL's meta handler. got that? */
+
+        /* check for a per-server context pool */
+        cfg = ap_get_module_config(vs->module_config, modp);
+        if (cfg->ctx_pool_name) {
+            MP_TRACE_c(vs, "server %p has a per-server context pool '%s'", vs, cfg->ctx_pool_name);
+            if (!(ctxp = modparrot_startup(pconf, vs, NULL,
+                cfg->ctx_pool_name))) {
+                return HTTP_INTERNAL_SERVER_ERROR;
+            }
+            /* cache for later -- select_ctx_pool depends on it! */
+            cfg->ctx_pool = ctxp->ctx_pool;
+        }
+        else {
+            MP_TRACE_c(vs, "using default context pool for server %p", vs);
+        }
+
         cloned = clone_ctx_state(ctxp,
             select_ctx_pool(modp, vs, NULL), vs, ptemp);
         if (cloned != ctxp) {
@@ -940,10 +960,6 @@
         /* reset the server_rec, but everything else should be ok */
         ctxp->s = vs;
 
-        /* we duplicate some efforts here because we only find out about
-         * named context pools configured from an HLL when we're already in
-         * that HLL's meta handler. got that? */
-
         /* load ParrotLoad files */
         modparrot_load_files(ctxp->interp, vs, vscfg->preload);