[Opensrf-commits] r1347 - trunk/src/gateway

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jun 24 16:47:52 EDT 2008


Author: erickson
Date: 2008-06-24 16:47:49 -0400 (Tue, 24 Jun 2008)
New Revision: 1347

Modified:
   trunk/src/gateway/osrf_json_gateway.c
Log:
added some cleanup code on child exit to ensure friendly shutdown of sockets

Modified: trunk/src/gateway/osrf_json_gateway.c
===================================================================
--- trunk/src/gateway/osrf_json_gateway.c	2008-06-19 21:04:17 UTC (rev 1346)
+++ trunk/src/gateway/osrf_json_gateway.c	2008-06-24 20:47:49 UTC (rev 1347)
@@ -85,6 +85,11 @@
 	return (void*) cfg;
 }
 
+static apr_status_t child_exit(void* data) {
+    osrfLogInfo(OSRF_LOG_MARK, "Disconnecting on child cleanup...");
+    osrf_system_shutdown();
+    return OK;
+}
 
 static void osrf_json_gateway_child_init(apr_pool_t *p, server_rec *s) {
 
@@ -109,6 +114,10 @@
 		ap_log_error( APLOG_MARK, APLOG_DEBUG, 0, s, 
 			"allowed service: %s\n", osrfStringArrayGetString(allowedServices, i));
 	}
+
+    // when this pool is cleaned up, it means the child 
+    // process is going away.  register some cleanup code
+    apr_pool_cleanup_register(p, NULL, child_exit, NULL);
 }
 
 static int osrf_json_gateway_method_handler (request_rec *r) {



More information about the opensrf-commits mailing list