subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1408153 - in /subversion/trunk/subversion/libsvn_ra_serf: ra_serf.h update.c util.c
Date Sun, 11 Nov 2012 23:38:33 GMT
Author: lgo
Date: Sun Nov 11 23:38:32 2012
New Revision: 1408153

URL: http://svn.apache.org/viewvc?rev=1408153&view=rev
Log:
ra_serf: Reuse the 4th connection for GET and PROPFIND requests when the 
REPORT response is completely received.

* subversion/libsvn_ra_serf/ra_serf.h
  (svn_ra_serf__process_pending): Add network_eof output argument.

* subversion/libsvn_ra_serf/util.c
  (svn_ra_serf__process_pending): Fill in the new network_eof output argument
   with the current 'received status' of the REPORT response.

* subversion/libsvn_ra_serf/update.c
  (report_context_t): Add report_received member variable.
  (get_best_connection): Add the first connection to the round-robin list
   when the REPORT is completely received.
  (finish_report): Update call to svn_ra_serf__process_pending.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
    subversion/trunk/subversion/libsvn_ra_serf/update.c
    subversion/trunk/subversion/libsvn_ra_serf/util.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1408153&r1=1408152&r2=1408153&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Sun Nov 11 23:38:32 2012
@@ -959,6 +959,7 @@ svn_ra_serf__xml_pop_state(svn_ra_serf__
 
 svn_error_t *
 svn_ra_serf__process_pending(svn_ra_serf__xml_parser_t *parser,
+                             svn_boolean_t *network_eof,
                              apr_pool_t *scratch_pool);
 
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1408153&r1=1408152&r2=1408153&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Sun Nov 11 23:38:32 2012
@@ -366,6 +366,9 @@ struct report_context_t {
   /* Are we done parsing the REPORT response? */
   svn_boolean_t done;
 
+  /* Did we receive all data from the network? */
+  svn_boolean_t report_received;
+
   /* Did we get a complete (non-truncated) report? */
   svn_boolean_t report_completed;
 
@@ -376,22 +379,29 @@ struct report_context_t {
   svn_boolean_t closed_root;
 };
 
-
-/* Returns best connection for fetching files/properities. */
+/* Returns best connection for fetching files/properties. */
 static svn_ra_serf__connection_t *
 get_best_connection(report_context_t *ctx)
 {
   svn_ra_serf__connection_t * conn;
+  int first_conn;
+
+  /* Skip the first connection if the REPORT response hasn't been completely
+     received yet. */
+  first_conn = ctx->report_received ? 0: 1;
+
+  if (ctx->sess->num_conns - first_conn == 1)
+    return ctx->sess->conns[first_conn];
 
-  /* Currently just cycle connection. In future we could store number of
-   * pending request on each connection for better connection usage. */
+  /* Currently just cycle connections. In future we could store number of
+   * pending requests on each connection for better connection usage. */
   conn = ctx->sess->conns[ctx->sess->cur_conn];
 
   /* Switch our connection. */
   ctx->sess->cur_conn++;
 
   if (ctx->sess->cur_conn >= ctx->sess->num_conns)
-      ctx->sess->cur_conn = 1;
+      ctx->sess->cur_conn = first_conn;
 
   return conn;
 }
@@ -2728,7 +2738,9 @@ finish_report(void *report_baton,
          present (we can't know for sure because of the private structure),
          then go process the pending content.  */
       if (!parser_ctx->paused && parser_ctx->pending != NULL)
-        SVN_ERR(svn_ra_serf__process_pending(parser_ctx, iterpool_inner));
+        SVN_ERR(svn_ra_serf__process_pending(parser_ctx,
+                                             &report->report_received,
+                                             iterpool_inner));
 
       /* Debugging purposes only! */
       for (i = 0; i < sess->num_conns; i++)

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1408153&r1=1408152&r2=1408153&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Sun Nov 11 23:38:32 2012
@@ -1404,6 +1404,7 @@ xml_parser_cleanup(void *baton)
 
 svn_error_t *
 svn_ra_serf__process_pending(svn_ra_serf__xml_parser_t *parser,
+                             svn_boolean_t *network_eof,
                              apr_pool_t *scratch_pool)
 {
   svn_boolean_t pending_empty = FALSE;
@@ -1411,7 +1412,10 @@ svn_ra_serf__process_pending(svn_ra_serf
 
   /* Fast path exit: already paused, nothing to do, or already done.  */
   if (parser->paused || parser->pending == NULL || *parser->done)
-    return SVN_NO_ERROR;
+    {
+      *network_eof = parser->pending ? parser->pending->network_eof : FALSE;
+      return SVN_NO_ERROR;
+    }
 
   /* Parsing the pending conten in the spillbuf will result in many disc i/o
      operations. This can be so slow that we don't run the network event
@@ -1434,7 +1438,7 @@ svn_ra_serf__process_pending(svn_ra_serf
 
           /* If the XML parsing callbacks paused us, then we're done for now.  */
           if (parser->paused)
-            return SVN_NO_ERROR;
+            break;
 
           cur_read += len;
         }
@@ -1462,6 +1466,8 @@ svn_ra_serf__process_pending(svn_ra_serf
       add_done_item(parser);
     }
 
+  *network_eof = parser->pending ? parser->pending->network_eof : FALSE;
+
   return SVN_NO_ERROR;
 }
 #undef PENDING_TO_PARSE



Mime
View raw message