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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Aug 9 08:31:34 EDT 2010


Author: scottmk
Date: 2010-08-09 08:31:33 -0400 (Mon, 09 Aug 2010)
New Revision: 1991

Modified:
   trunk/src/libopensrf/osrf_application.c
Log:
Fixed a bug in the chunking.

Short version: The non-atomic system methods weren't working.  Now
they are.

Long version: When a method returns a value greater than zero, a
post-processing step sends a STATUS message to signify that the
response is complete.  In the old code this post-processing
bypassed the buffer-flushing step, so that anything still in the
buffer didn't get sent.

The non-atomic system methods returned positive return codes and
were therefore subject to this problem.  I don't know if any
non-system methods return postive return codes, but if they do,
they would also have been affected.

M    src/libopensrf/osrf_application.c


Modified: trunk/src/libopensrf/osrf_application.c
===================================================================
--- trunk/src/libopensrf/osrf_application.c	2010-08-05 17:40:45 UTC (rev 1990)
+++ trunk/src/libopensrf/osrf_application.c	2010-08-09 12:31:33 UTC (rev 1991)
@@ -678,17 +678,18 @@
 			ctx->method->name, retcode );
 
 	if(ctx->responses) {
-		// We have cached responses to return, collected in a JSON ARRAY (we haven't sent
-		// any responses yet).  Now send them all at once, followed by a STATUS message
-		// to say that we're finished.
+		// We have cached atomic responses to return, collected in a JSON ARRAY (we
+		// haven't sent any responses yet).  Now send them all at once, followed by
+		// a STATUS message to say that we're finished.
 		osrfAppRequestRespondComplete( ctx->session, ctx->request, ctx->responses );
 
 	} else {
-		// We have no cached responses to return.
+		// We have no cached atomic responses to return, but we may have some
+		// non-atomic messages waiting in the buffer.
 		if( retcode > 0 )
-			// Send a STATUS message to say that we're finished.
-			osrfAppSessionStatus( ctx->session, OSRF_STATUS_COMPLETE,
-					"osrfConnectStatus", ctx->request, "Request Complete" );
+			// Send a STATUS message to say that we're finished, and to force a
+			// final flush of the buffer.
+			osrfAppRespondComplete( ctx, NULL );
 	}
 
 	return 0;



More information about the opensrf-commits mailing list