a client socket open. you can force it, which the forked children must do to get their own sockets,
but in general, a single process will share the same connection
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@685
9efc2488-bf62-4759-914b-
345cdb29e865
osrfLogDebug( OSRF_LOG_MARK, "Child init hook for child %d", child->pid);
char* resc = va_list_to_string("%s_drone",child->appname);
+ /* we want to remove traces of our parents socket connection
+ * so we can have our own */
+ osrfSystemIgnoreTransportClient();
+
if(!osrf_system_bootstrap_client_resc( NULL, NULL, resc)) {
osrfLogError( OSRF_LOG_MARK, "Unable to bootstrap client for osrf_prefork_run()");
free(resc);
return __osrfGlobalTransportClient;
}
+void osrfSystemIgnoreTransportClient() {
+ __osrfGlobalTransportClient = NULL;
+}
+
transport_client* osrf_system_get_transport_client() {
return __osrfGlobalTransportClient;
}
int osrf_system_bootstrap_client_resc( char* config_file, char* contextnode, char* resource ) {
+ if(osrfSystemGetTransportClient()) {
+ osrfLogInfo(OSRF_LOG_MARK, "Client is already bootstrapped");
+ return 1; /* we already have a client connection */
+ }
+
if( !( config_file && contextnode ) && ! osrfConfigHasDefaultConfig() ) {
osrfLogError( OSRF_LOG_MARK, "No Config File Specified\n" );
return -1;
int _osrfSystemInitCache();
+
+/* this will clear the global transport client pointer without
+ * actually destroying the socket. this is useful for allowing
+ * children to have their own socket, even though their parent
+ * already created a socket
+ */
+void osrfSystemIgnoreTransportClient();
+
+
#endif