From adadc84f94e59fa675883124244adff24306dcc0 Mon Sep 17 00:00:00 2001 From: scottmk Date: Mon, 9 Aug 2010 12:31:33 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1991 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libopensrf/osrf_application.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libopensrf/osrf_application.c b/src/libopensrf/osrf_application.c index 141d39f..6eba7be 100644 --- a/src/libopensrf/osrf_application.c +++ b/src/libopensrf/osrf_application.c @@ -678,17 +678,18 @@ static int _osrfAppPostProcess( osrfMethodContext* ctx, int retcode ) { 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; -- 2.43.2