[Opensrf-commits] r1887 - trunk/src/libopensrf (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Jan 9 15:23:10 EST 2010


Author: scottmk
Date: 2010-01-09 15:23:05 -0500 (Sat, 09 Jan 2010)
New Revision: 1887

Modified:
   trunk/src/libopensrf/osrf_app_session.c
Log:
In srf_app_server_session_init(): if the requested session already
exists, treat it as an error.

M    src/libopensrf/osrf_app_session.c


Modified: trunk/src/libopensrf/osrf_app_session.c
===================================================================
--- trunk/src/libopensrf/osrf_app_session.c	2010-01-08 21:14:35 UTC (rev 1886)
+++ trunk/src/libopensrf/osrf_app_session.c	2010-01-09 20:23:05 UTC (rev 1887)
@@ -508,16 +508,14 @@
 }
 
 /**
-	@brief Find or create an osrfAppSession for a server.
+	@brief Create an osrfAppSession for a server.
 	@param session_id The session ID.  In practice this comes from the thread member of
 	the transport message from the client.
 	@param our_app The name of the service being provided.
 	@param remote_id Jabber ID of the client.
 	@return Pointer to the newly created osrfAppSession if successful, or NULL upon failure.
 
-	First, look in the global session cache for a session with the specified session ID.
-	If you find one, return it immediately, ignoring the values of the @a our_app and @a
-	remote_id parameters.  Otherwise:
+	If there is already a session with the specified id, report an error.  Otherwise:
 
 	- Allocate memory for an osrfAppSession.
 	- For talking with Jabber, grab an existing transport_client.  It should have been
@@ -535,12 +533,12 @@
 	osrfLogDebug( OSRF_LOG_MARK, "Initing server session with session id %s, service %s,"
 			" and remote_id %s", session_id, our_app, remote_id );
 
-	// If such a session already exists, return it without further ado.
-	// In practice this should never happen, and should probably be treated as an
-	// error if it ever does.
 	osrfAppSession* session = osrf_app_session_find_session( session_id );
-	if(session)
-		return session;
+	if(session) {
+		osrfLogWarning( OSRF_LOG_MARK, "App session already exists for session id %s",
+				session_id );
+		return NULL;
+	}
 
 	session = safe_malloc(sizeof(osrfAppSession));
 



More information about the opensrf-commits mailing list