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 2017/08/07 22:31:42 UTC

svn commit: r1804364 - in /tcl/rivet/trunk: ChangeLog src/mod_rivet_ng/mod_rivet.c

Author: mxmanghi
Date: Mon Aug  7 22:31:42 2017
New Revision: 1804364

URL: http://svn.apache.org/viewvc?rev=1804364&view=rev
Log:
	* src/mod_rivet_ng/mod_rivet.c: Rivet_ServerInit is now implementing
	the recommended mechanism to avoid the double load of external
	modules


Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1804364&r1=1804363&r2=1804364&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Mon Aug  7 22:31:42 2017
@@ -1,3 +1,8 @@
+2017-08-07 Massimo Manghi <mx...@apache.org>
+	* src/mod_rivet_ng/mod_rivet.c: Rivet_ServerInit is now implementing
+	the recommended mechanism to avoid the double load of external
+	modules
+
 2017-07-24 Massimo Manghi <mx...@apache.org>
 	* xml/rivet.xml.in: reflects rivet.xml having been moved to doc/xml
 	* rivet/default_request_handler.tcl: code of the default 

Modified: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c?rev=1804364&r1=1804363&r2=1804364&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c Mon Aug  7 22:31:42 2017
@@ -261,6 +261,8 @@ static int
 Rivet_ServerInit (apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp, server_rec *server)
 {
     apr_dso_handle_t*   dso_handle;
+	void*				userdata;
+	const char 			*userdata_key = "rivet_post_config";
 
 #if RIVET_DISPLAY_VERSION
     ap_add_version_component(pPool,RIVET_PACKAGE_NAME"/"RIVET_VERSION);
@@ -268,6 +270,24 @@ Rivet_ServerInit (apr_pool_t *pPool, apr
     ap_add_version_component(pPool,RIVET_PACKAGE_NAME);
 #endif
 
+	/* This function runs as post_config_hook
+	 * and as such it's run twice by design. 
+	 * This is the recommended way to avoid a double load of
+	 * external modules.
+	 */
+
+	apr_pool_userdata_get(&userdata, userdata_key, server->process->pool);
+	if (userdata == NULL)
+	{
+		apr_pool_userdata_set((const void *)1, userdata_key,
+                              apr_pool_cleanup_null, server->process->pool);
+
+        ap_log_error(APLOG_MARK,APLOG_INFO,0,server,
+                     "first post_config run: not initializing Tcl stuff");
+
+        return OK; /* This would be the first time through */
+	}
+
     /* Everything revolves around this structure: module_globals */
 
     /* the module global structure is allocated and the MPM bridge name established */



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