[Opensrf-commits] r1873 - in trunk: include/opensrf src/libopensrf src/srfsh (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Dec 14 15:38:49 EST 2009


Author: scottmk
Date: 2009-12-14 15:38:44 -0500 (Mon, 14 Dec 2009)
New Revision: 1873

Modified:
   trunk/include/opensrf/osrf_app_session.h
   trunk/src/libopensrf/osrf_app_session.c
   trunk/src/srfsh/srfsh.c
Log:
1. In osrf_app_session.[ch]: Create a new function
osrfAppSessionSendRequest(), similar to osrfAppSessionMakeRequest()
but without the param_strings parameter.

2. Replace the old function with the new one in srfsh.c.

M    include/opensrf/osrf_app_session.h
M    src/libopensrf/osrf_app_session.c
M    src/srfsh/srfsh.c


Modified: trunk/include/opensrf/osrf_app_session.h
===================================================================
--- trunk/include/opensrf/osrf_app_session.h	2009-12-10 17:42:14 UTC (rev 1872)
+++ trunk/include/opensrf/osrf_app_session.h	2009-12-14 20:38:44 UTC (rev 1873)
@@ -103,14 +103,22 @@
 /** returns a session from the global session hash */
 osrfAppSession* osrf_app_session_find_session( const char* session_id );
 
-/** Builds a new app_request object with the given payload andn returns
+/** Builds a new app_request object with the given payload and returns
 	the id of the request.  This id is then used to perform work on the
-	requeset.
+	request.  DEPRECATED; use osrfAppSessionSendRequest() instead.
 */
 int osrfAppSessionMakeRequest(
 		osrfAppSession* session, const jsonObject* params,
 		const char* method_name, int protocol, osrfStringArray* param_strings);
 
+/** Builds a new app_request object with the given payload and returns
+	the id of the request.  This id is then used to perform work on the
+	request.
+ */
+int osrfAppSessionSendRequest(
+		 osrfAppSession* session, const jsonObject* params,
+		 const char* method_name, int protocol );
+
 /** Sets the given request to complete state */
 void osrf_app_session_set_complete( osrfAppSession* session, int request_id );
 

Modified: trunk/src/libopensrf/osrf_app_session.c
===================================================================
--- trunk/src/libopensrf/osrf_app_session.c	2009-12-10 17:42:14 UTC (rev 1872)
+++ trunk/src/libopensrf/osrf_app_session.c	2009-12-14 20:38:44 UTC (rev 1873)
@@ -161,7 +161,7 @@
 }
 
 /**
-	Checke the receive queue for messages.  If any are found, the first
+	Checks the receive queue for messages.  If any are found, the first
 	is popped off and returned.  Otherwise, this method will wait at most timeout
 	seconds for a message to appear in the receive queue.  Once it arrives it is returned.
 	If no messages arrive in the timeout provided, null is returned.
@@ -466,6 +466,9 @@
 	@param param_strings Another way of specifying the parameters for the method.
 	@return The request ID of the resulting REQUEST message, or -1 upon error.
 
+	DEPRECATED.  Use osrfAppSessionSendRequest() instead.  It is identical except that it
+	doesn't use the param_strings argument, which is redundant, confusing, and unused.
+
 	If @a params is non-NULL, use it to specify the parameters to the method.  Otherwise
 	use @a param_strings.
 
@@ -495,12 +498,34 @@
 	@param params One way of specifying the parameters for the method.
 	@param method_name The name of the method to be called.
 	@param protocol Protocol.
+	@return The request ID of the resulting REQUEST message, or -1 upon error.
+
+	If @a params points to a JSON_ARRAY, then pass each element of the array as a separate
+	parameter.  If @a params points to any other kind of jsonObject, pass it as a single
+	parameter.
+
+	This function is a thin wrapper for osrfAppSessionMakeLocaleRequest().
+*/
+int osrfAppSessionSendRequest( osrfAppSession* session, const jsonObject* params,
+		const char* method_name, int protocol ) {
+
+	return osrfAppSessionMakeLocaleRequest( session, params,
+		 method_name, protocol, NULL, NULL );
+}
+
+/**
+	@brief Create a REQUEST message, send it, and save it for future reference.
+	@param session Pointer to the current session, which has the addressing information.
+	@param params One way of specifying the parameters for the method.
+	@param method_name The name of the method to be called.
+	@param protocol Protocol.
 	@param param_strings Another way of specifying the parameters for the method.
 	@param locale Pointer to a locale string.
 	@return The request ID of the resulting REQUEST message, or -1 upon error.
 
-	See the discussion of osrfAppSessionMakeRequest(), which at this writing is the only
-	place that calls this function.
+	See the discussion of osrfAppSessionSendRequest(), which at this writing is the only
+	place that calls this function, except for the similar but deprecated function
+	osrfAppSessionMakeRequest().
 
 	At this writing, the @a param_strings and @a locale parameters are always NULL.
 */

Modified: trunk/src/srfsh/srfsh.c
===================================================================
--- trunk/src/srfsh/srfsh.c	2009-12-10 17:42:14 UTC (rev 1872)
+++ trunk/src/srfsh/srfsh.c	2009-12-14 20:38:44 UTC (rev 1873)
@@ -789,7 +789,7 @@
 
 	double start = get_timestamp_millis();
 
-	int req_id = osrfAppSessionMakeRequest( session, params, method, 1, NULL );
+	int req_id = osrfAppSessionSendRequest( session, params, method, 1 );
 	jsonObjectFree(params);
 
 	osrfMessage* omsg = osrfAppSessionRequestRecv( session, req_id, recv_timeout );
@@ -1092,7 +1092,7 @@
 			++running;
 
 			double start = get_timestamp_millis();
-			int req_id = osrfAppSessionMakeRequest( session, params, methods[j], 1, NULL );
+			int req_id = osrfAppSessionSendRequest( session, params, methods[j], 1 );
 			osrfMessage* omsg = osrfAppSessionRequestRecv( session, req_id, 5 );
 			double end = get_timestamp_millis();
 



More information about the opensrf-commits mailing list