You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2011/06/21 20:27:14 UTC
svn commit: r1138119 - /subversion/trunk/subversion/libsvn_ra_serf/util.c
Author: gstein
Date: Tue Jun 21 18:27:14 2011
New Revision: 1138119
URL: http://svn.apache.org/viewvc?rev=1138119&view=rev
Log:
Write the rest of the code for redirecting content to the PENDING
structures when the parser is 'paused'.
This code is not yet enabled because the EOF handling needs to be
corrected. Right now, when the network content is finished, this code
free's the XML parser. But we may need to keep it around for parsing
the pending content.
And I just realized that the network code cannot simply inject the
arriving content into the parser. There may be stuff in PENDING that needs
to be inject first. That is, this code may inject it out of order.
Committing anyway as this demonstrates more of the direction of this code.
* subversion/libsvn_ra_serf/util.c:
(svn_ra_serf__handle_xml_parser): pre-position the spill file to append
content in write_to_pending(). switch to the PARSE_CHUNK_SIZE symbol
rather than a bare constant. add logic to alternately write to the
PENDING structures, or inject it into the xml parser.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/util.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1138119&r1=1138118&r2=1138119&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Tue Jun 21 18:27:14 2011
@@ -1485,24 +1485,50 @@ svn_ra_serf__handle_xml_parser(serf_requ
}
}
+ /* If we are storing content into a spill file, then move to the end of
+ the file. We need to pre-position the file so that write_to_pending()
+ will always append the content. */
+ if (ctx->pending != NULL && ctx->pending->spill != NULL)
+ {
+ apr_off_t output_unused = 0; /* ### stupid API */
+
+ SVN_ERR(svn_io_file_seek(ctx->pending->spill,
+ APR_END, &output_unused,
+ pool));
+ }
+
while (1)
{
const char *data;
apr_size_t len;
- status = serf_bucket_read(response, 8000, &data, &len);
+ status = serf_bucket_read(response, PARSE_CHUNK_SIZE, &data, &len);
if (SERF_BUCKET_READ_ERROR(status))
{
return svn_error_wrap_apr(status, NULL);
}
- err = inject_to_parser(ctx, data, len, &sl);
+ /* Note: once the callbacks invoked by inject_to_parser() sets the
+ PAUSED flag, then it will not be cleared. write_to_pending() will
+ only save the content. Logic outside of serf_context_run() will
+ clear that flag, as appropriate, along with processing the
+ content that we have placed into the PENDING buffer. */
+ if (0 /* ### not yet... ctx->paused */)
+ {
+ err = write_to_pending(ctx, data, len, pool);
+ }
+ else
+ {
+ err = inject_to_parser(ctx, data, len, &sl);
+ if (err)
+ {
+ /* Should have no errors if IGNORE_ERRORS is set. */
+ SVN_ERR_ASSERT(!ctx->ignore_errors);
+ }
+ }
if (err)
{
- /* Should have no errors if IGNORE_ERRORS is set. */
- SVN_ERR_ASSERT(!ctx->ignore_errors);
-
XML_ParserFree(ctx->xmlp);
add_done_item(ctx);
return svn_error_return(err);