[Opensrf-commits] r1899 - trunk/src/router (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 20 20:08:38 EST 2010
Author: scottmk
Date: 2010-01-20 20:08:37 -0500 (Wed, 20 Jan 2010)
New Revision: 1899
Modified:
trunk/src/router/osrf_router.c
Log:
Bug fix.
When all the servers for a given server go away, the router deletes the
server class from its internal data structures. However that can happen
in the middle of a loop receiving successive messages from that server.
The old code would continue trying to read more messages from the
deleted server class, leading to a segfault.
The new code checks to see whether the server class still exists. If
not, it breaks out of the loop.
M src/router/osrf_router.c
Modified: trunk/src/router/osrf_router.c
===================================================================
--- trunk/src/router/osrf_router.c 2010-01-20 17:56:44 UTC (rev 1898)
+++ trunk/src/router/osrf_router.c 2010-01-21 01:08:37 UTC (rev 1899)
@@ -345,6 +345,12 @@
// A previous message bounced. Try to send a clone of it to a
// different node of the same class.
+
+ // First make a local copy of the class name. If the class gets
+ // deleted, the classname parameter becomes invalid.
+ char classname_copy[ strlen( classname ) + 1 ];
+ strcpy( classname_copy, classname );
+
transport_message* bouncedMessage = osrfRouterClassHandleBounce(
router, classname, class, msg );
/* handle bounced message */
@@ -352,7 +358,12 @@
/* we have no one to send the requested message to */
message_free( msg );
osrfLogClearXid();
- continue;
+
+ // See if the class still exists
+ if( osrfHashGet( router->classes, classname_copy ) )
+ continue; // It does; keep going
+ else
+ break; // It doesn't; don't try to read from it any more
}
osrfRouterClassHandleMessage( router, class, bouncedMessage );
message_free( bouncedMessage );
More information about the opensrf-commits
mailing list