[Opensrf-commits] r1835 - trunk/src/router (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Oct 31 12:49:18 EDT 2009


Author: scottmk
Date: 2009-10-31 12:49:15 -0400 (Sat, 31 Oct 2009)
New Revision: 1835

Modified:
   trunk/src/router/osrf_router.c
   trunk/src/router/osrf_router_main.c
Log:
Fixed a bug in osrfRouterClassFree().  We were trying free
the same osrfRouterClass twice -- once directly, and once
by an unintended recursion.

M    src/router/osrf_router.c
M    src/router/osrf_router_main.c


Modified: trunk/src/router/osrf_router.c
===================================================================
--- trunk/src/router/osrf_router.c	2009-10-31 16:28:38 UTC (rev 1834)
+++ trunk/src/router/osrf_router.c	2009-10-31 16:49:15 UTC (rev 1835)
@@ -9,7 +9,7 @@
 	@brief Maintains a set of server nodes belonging to the same class.
 */
 struct _osrfRouterClassStruct {
-	osrfRouter* router;         /**< The osrfRouter that owns this osrfRouterClass */
+	osrfRouter* router;         /**< The osrfRouter that owns this osrfRouterClass. */
 	osrfHashIterator* itr;      /**< Iterator for set of osrfRouterNodes. */
 	/**
 		@brief Hash store of server nodes.
@@ -552,7 +552,7 @@
 	osrfRouterNode* node;
 
 	while( (node = osrfHashIteratorNext(rclass->itr)) )
-		osrfRouterClassRemoveNode( rclass->router, classname, node->remoteId );
+		osrfHashRemove( rclass->nodes, node->remoteId );
 
 	osrfHashIteratorFree(rclass->itr);
 	osrfHashFree(rclass->nodes);

Modified: trunk/src/router/osrf_router_main.c
===================================================================
--- trunk/src/router/osrf_router_main.c	2009-10-31 16:28:38 UTC (rev 1834)
+++ trunk/src/router/osrf_router_main.c	2009-10-31 16:49:15 UTC (rev 1835)
@@ -29,25 +29,18 @@
 static osrfRouter* router = NULL;
 
 /**
-	@brief Respond to signal by exiting immediately.
+	@brief Respond to signal by cleaning up and exiting immediately.
 	@param signo The signal number.
 */
 void routerSignalHandler( int signo ) {
 	osrfLogWarning( OSRF_LOG_MARK, "Received signal [%d], cleaning up...", signo );
 
-    /* for now, just forcibly exit.  This is not a friendly way to clean up, but
-     * there is a bug in osrfRouterFree() (in particular with cleaning up sockets),
-     * that can cause the router process to stick around.  If we do this, we
-     * are guaranteed to exit.
-     */
-    _exit(0);
-
 	osrfConfigCleanup();
 	osrfRouterFree(router);
+	osrfLogWarning( OSRF_LOG_MARK, "Cleanup successful.  Re-raising signal" );
 	router = NULL;
 
-	// Exit by re-raising the signal so that the parent
-	// process can detect it
+	// Re-raise the signal so that the parent process can detect it.
 	
 	signal( signo, SIG_DFL );
 	raise( signo );



More information about the opensrf-commits mailing list