Author: rhuijben
Date: Sun Aug  7 17:38:07 2011
New Revision: 1154733

URL: http://svn.apache.org/viewvc?rev=1154733&view=rev
Log:
Fix the problem in serf that made it impossible to checkout neon with serf.
(The real problem was performing checkouts from Subversion 1.3 repositories
 and/or from repositories that sometimes close connections halfway during
 a request)

* subversion/libsvn_ra_serf/update.c
  (handle_fetch): Correctly calculate how much buffer to keep after skipping
    already read data. Add a helper variable to make the code a bit clearer.
    (The data pointer wasn't updated correctly while the size was)

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/update.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1154733&r1=1154732&r2=1154733&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Sun Aug  7 17:38:07 2011
@@ -918,6 +918,7 @@ handle_fetch(serf_request_t *request,
 
       if (fetch_ctx->aborted_read)
         {
+          apr_off_t skip;
           /* We haven't caught up to where we were before. */
           if (fetch_ctx->read_size < fetch_ctx->aborted_read_size)
             {
@@ -938,9 +939,10 @@ handle_fetch(serf_request_t *request,
           /* Woo-hoo.  We're back. */
           fetch_ctx->aborted_read = FALSE;
 
-          /* Increment data and len by the difference. */
-          data += fetch_ctx->read_size - fetch_ctx->aborted_read_size;
-          len = fetch_ctx->read_size - fetch_ctx->aborted_read_size;
+          /* Update data and len to just provide the new data. */
+          skip = len - (fetch_ctx->read_size - fetch_ctx->aborted_read_size);
+          data += skip;
+          len -= skip;
         }
 
       if (fetch_ctx->delta_stream)


Reply via email to