You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2014/08/15 00:42:33 UTC

svn commit: r1618076 - in /tcl/rivet/trunk: Makefile.in src/experimental/mod_rivet.c

Author: mxmanghi
Date: Thu Aug 14 22:42:33 2014
New Revision: 1618076

URL: http://svn.apache.org/r1618076
Log:
adding a few comments and converted test on a pointer as argument to ap_assert, as the condition in case is not recoverable

Modified:
    tcl/rivet/trunk/Makefile.in
    tcl/rivet/trunk/src/experimental/mod_rivet.c

Modified: tcl/rivet/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/Makefile.in?rev=1618076&r1=1618075&r2=1618076&view=diff
==============================================================================
--- tcl/rivet/trunk/Makefile.in (original)
+++ tcl/rivet/trunk/Makefile.in Thu Aug 14 22:42:33 2014
@@ -17,7 +17,7 @@
 #
 # top-level Makefile.am for Apache Rivet: gets turned into a Makefile.in by automake
 #
-# $Id: Makefile.am 1616967 2014-08-09 15:29:07Z mxmanghi $
+# $Id: Makefile.am 1517859 2013-08-27 16:08:31Z mxmanghi $
 #
 # 2007/12/25: Added target uninistall-local that removes the tcl stuff (mxmanghi)
 # 2010/06/22: target instal-data-local searches for pkgIndex.tcl files and deletes them

Modified: tcl/rivet/trunk/src/experimental/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/mod_rivet.c?rev=1618076&r1=1618075&r2=1618076&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/experimental/mod_rivet.c Thu Aug 14 22:42:33 2014
@@ -147,6 +147,12 @@ rivet_thread_private* Rivet_VirtualHosts
     
     root_interp = (*module_globals->mpm_master_interp)(private->pool);
 
+    /* we must assume the module was able to create the root interprter */ 
+
+    ap_assert (root_interp != NULL);
+
+    /* Using the root interpreter we evaluate the global initialization script, if any */
+
     if (root_server_conf->rivet_global_init_script != NULL) {
         if (Tcl_EvalObjEx(root_interp->interp, root_server_conf->rivet_global_init_script, 0) != TCL_OK)
         {
@@ -161,17 +167,24 @@ rivet_thread_private* Rivet_VirtualHosts
         }
     }
 
+    /* then we proceed assigning/creating the interpreters for the
+     * virtual hosts known to the server
+     */
+
     parentfunction = root_server_conf->rivet_child_init_script;
-    if (root_interp == NULL)
-    {
-        return NULL;
-    }
 
     for (s = root_server; s != NULL; s = s->next)
     {
         vhost_interp*   rivet_interp;
 
         myrsc = RIVET_SERVER_CONF(s->module_config);
+
+        /* by default we assign the root_interpreter as
+         * interpreter of the virtual host. In case of separate
+         * virtual interpreters we create new ones for each
+         * virtual host 
+         */
+
         rivet_interp = root_interp;
 
         if (s == root_server)
@@ -197,17 +210,19 @@ rivet_thread_private* Rivet_VirtualHosts
             rivet_interp->flags |= RIVET_INTERP_INITIALIZED;
         }
 
-        /*  Check if it's absolutely necessary to lock the pool_mutex in order
-            to allocate from the module global pool 
+        /*  TODO: check if it's absolutely necessary to lock the pool_mutex in order
+            to allocate from the module global pool */
 
-            this stuff must be allocated from the module global pool which
-            ha the same child process lifespan
+        /*  this stuff must be allocated from the module global pool which
+         *  has the child process lifespan
          */
 
         apr_thread_mutex_lock(module_globals->pool_mutex);
         myrsc->server_name = (char*)apr_pstrdup(module_globals->pool, s->server_hostname);
         apr_thread_mutex_unlock(module_globals->pool_mutex);
 
+        /* if configured child init script gets evaluated */
+
         function = myrsc->rivet_child_init_script;
         if (function && 
             (s == root_server || root_server_conf->separate_virtual_interps || function != parentfunction))
@@ -218,8 +233,11 @@ rivet_thread_private* Rivet_VirtualHosts
             rivet_interp_globals* globals = Tcl_GetAssocData( interp, "rivet", NULL );
             Tcl_Preserve (interp);
 
-            /* There a lot of passing around pointers to record object
-             * and we keep it just for compatibility with existing components
+            /* There is a lot of passing around of pointers to various record 
+             * objects. We should understand if this is all that necessary.
+             * Here we assign the server_rec pointer to the interpreter which
+             * is wrong, because without separate interpreters it doens't make
+             * any sense. TODO
              */
 
             globals->srec = s;
@@ -272,6 +290,10 @@ void Rivet_ProcessorCleanup (void *data)
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, module_globals->server, 
                  "Thread exiting after %d requests served", private->req_cnt);
+
+    /* there must be always a root interpreter in the slot 0 of private->interps,
+       so there is always need to run at least one cycle here */
+
     i = 0;
     do
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org