From: erickson Date: Mon, 11 Feb 2008 18:49:44 +0000 (+0000) Subject: makeing osrfSystemCacheInit() a "public" function. pushing osrfSystemCacheInit(... X-Git-Tag: osrf_rel_2_0_1~720 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=82dc58ad267562faf580e95c41b6a80dd2ded405;p=OpenSRF.git makeing osrfSystemCacheInit() a "public" function. pushing osrfSystemCacheInit() into the child_init phase to prevent shared cache handles. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1247 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/include/opensrf/osrf_system.h b/include/opensrf/osrf_system.h index 12243a4..24dfacb 100644 --- a/include/opensrf/osrf_system.h +++ b/include/opensrf/osrf_system.h @@ -52,4 +52,7 @@ int osrf_system_shutdown( void ); void osrfSystemIgnoreTransportClient(); +/** Initialize the cache connection */ +int osrfSystemInitCache(void); + #endif diff --git a/src/libopensrf/osrf_cache.c b/src/libopensrf/osrf_cache.c index 389add1..16c6a54 100644 --- a/src/libopensrf/osrf_cache.c +++ b/src/libopensrf/osrf_cache.c @@ -20,6 +20,7 @@ static time_t _osrfCacheMaxSeconds = -1; 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(); diff --git a/src/libopensrf/osrf_prefork.c b/src/libopensrf/osrf_prefork.c index a5d5794..46d9975 100644 --- a/src/libopensrf/osrf_prefork.c +++ b/src/libopensrf/osrf_prefork.c @@ -177,6 +177,8 @@ static int prefork_child_init_hook(prefork_child* child) { 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*/ diff --git a/src/libopensrf/osrf_system.c b/src/libopensrf/osrf_system.c index f7d30ed..29d5aa6 100644 --- a/src/libopensrf/osrf_system.c +++ b/src/libopensrf/osrf_system.c @@ -3,7 +3,6 @@ #include #include -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 @@ int osrf_system_bootstrap_client( char* config_file, char* contextnode ) { 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 @@ int osrfSystemBootstrap( char* hostname, char* configfile, char* contextNode ) { jsonObject* apps = osrf_settings_host_value_object("/activeapps/appname"); osrfStringArray* arr = osrfNewStringArray(8); - _osrfSystemInitCache(); - if(apps) { int i = 0;