[Opensrf-commits] r1247 - in trunk: include/opensrf src/libopensrf

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Feb 11 14:18:55 EST 2008


Author: erickson
Date: 2008-02-11 13:49:44 -0500 (Mon, 11 Feb 2008)
New Revision: 1247

Modified:
   trunk/include/opensrf/osrf_system.h
   trunk/src/libopensrf/osrf_cache.c
   trunk/src/libopensrf/osrf_prefork.c
   trunk/src/libopensrf/osrf_system.c
Log:
makeing osrfSystemCacheInit() a "public" function.  pushing osrfSystemCacheInit() into the child_init phase to prevent shared cache handles.

Modified: trunk/include/opensrf/osrf_system.h
===================================================================
--- trunk/include/opensrf/osrf_system.h	2008-02-07 20:13:44 UTC (rev 1246)
+++ trunk/include/opensrf/osrf_system.h	2008-02-11 18:49:44 UTC (rev 1247)
@@ -52,4 +52,7 @@
 void osrfSystemIgnoreTransportClient();
 
 
+/** Initialize the cache connection */
+int osrfSystemInitCache(void);
+
 #endif

Modified: trunk/src/libopensrf/osrf_cache.c
===================================================================
--- trunk/src/libopensrf/osrf_cache.c	2008-02-07 20:13:44 UTC (rev 1246)
+++ trunk/src/libopensrf/osrf_cache.c	2008-02-11 18:49:44 UTC (rev 1247)
@@ -20,6 +20,7 @@
 
 int osrfCacheInit( const char* serverStrings[], int size, time_t maxCacheSeconds ) {
 	if( !(serverStrings && size > 0) ) return -1;
+    osrfCacheCleanup(); /* in case we've already been init-ed */
 
 	int i;
 	_osrfCache = mc_new();

Modified: trunk/src/libopensrf/osrf_prefork.c
===================================================================
--- trunk/src/libopensrf/osrf_prefork.c	2008-02-07 20:13:44 UTC (rev 1246)
+++ trunk/src/libopensrf/osrf_prefork.c	2008-02-11 18:49:44 UTC (rev 1247)
@@ -177,6 +177,8 @@
 
 	if(!child) return -1;
 	osrfLogDebug( OSRF_LOG_MARK, "Child init hook for child %d", child->pid);
+
+    osrfSystemInitCache();
 	char* resc = va_list_to_string("%s_drone",child->appname);
 
    /* if we're a source-client, tell the logger now that we're a new process*/

Modified: trunk/src/libopensrf/osrf_system.c
===================================================================
--- trunk/src/libopensrf/osrf_system.c	2008-02-07 20:13:44 UTC (rev 1246)
+++ trunk/src/libopensrf/osrf_system.c	2008-02-11 18:49:44 UTC (rev 1247)
@@ -3,7 +3,6 @@
 #include <opensrf/osrf_prefork.h>
 #include <signal.h>
 
-static int _osrfSystemInitCache( void );
 static void report_child_status( pid_t pid, int status );
 struct child_node;
 typedef struct child_node ChildNode;
@@ -38,7 +37,7 @@
 	return osrfSystemBootstrapClientResc(config_file, contextnode, NULL);
 }
 
-static int _osrfSystemInitCache( void ) {
+int osrfSystemInitCache( void ) {
 
 	jsonObject* cacheServers = osrf_settings_host_value_object("/cache/global/servers/server");
 	char* maxCache = osrf_settings_host_value("/cache/global/max_cache_time");
@@ -98,8 +97,6 @@
 	jsonObject* apps = osrf_settings_host_value_object("/activeapps/appname");
 	osrfStringArray* arr = osrfNewStringArray(8);
 	
-	_osrfSystemInitCache();
-
 	if(apps) {
 		int i = 0;
 



More information about the opensrf-commits mailing list