You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/01/25 18:13:37 UTC

svn commit: r1654669 - in /subversion/trunk/subversion/libsvn_ra_serf: commit.c get_file.c lock.c options.c ra_serf.h update.c util.c xml.c

Author: rhuijben
Date: Sun Jan 25 17:13:36 2015
New Revision: 1654669

URL: http://svn.apache.org/r1654669
Log:
Following up on r1654668, always pass a session to the function that creates
a new handler instance.

* subversion/libsvn_ra_serf/commit.c
  (checkout_node): Update caller.
  (proppatch_resource): Remove argument. Update caller.
  (open_root,
   delete_entry,
   add_directory,
   close_directory,
   add_file,
   close_file,
   close_edit,
   abort_edit,
   svn_ra_serf__change_rev_prop): Update caller.

* subversion/libsvn_ra_serf/get_file.c
  (svn_ra_serf__get_file): Update caller. Reduce variable scope.

* subversion/libsvn_ra_serf/lock.c
  (svn_ra_serf__unlock): Update caller.

* subversion/libsvn_ra_serf/options.c
  (svn_ra_serf__probe_proxy): Update caller.

* subversion/libsvn_ra_serf/ra_serf.h
  (svn_ra_serf__create_handler): Add session argument.

* subversion/libsvn_ra_serf/update.c
  (fetch_for_file): Update caller.

* subversion/libsvn_ra_serf/util.c
  (svn_ra_serf__create_handler): Add argument. Setup session and connection.

* subversion/libsvn_ra_serf/xml.c
  (svn_ra_serf__create_expat_handler): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/commit.c
    subversion/trunk/subversion/libsvn_ra_serf/get_file.c
    subversion/trunk/subversion/libsvn_ra_serf/lock.c
    subversion/trunk/subversion/libsvn_ra_serf/options.c
    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
    subversion/trunk/subversion/libsvn_ra_serf/xml.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/commit.c?rev=1654669&r1=1654668&r2=1654669&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/commit.c Sun Jan 25 17:13:36 2015
@@ -264,9 +264,7 @@ checkout_node(const char **working_url,
 
   /* HANDLER_POOL is the scratch pool since we don't need to remember
      anything from the handler. We just want the working resource.  */
-  handler = svn_ra_serf__create_handler(scratch_pool);
-  handler->session = commit_ctx->session;
-  handler->conn = commit_ctx->conn;
+  handler = svn_ra_serf__create_handler(commit_ctx->session, scratch_pool);
 
   handler->body_delegate = create_checkout_body;
   handler->body_delegate_baton = (/* const */ void *)commit_ctx->activity_url;
@@ -829,19 +827,16 @@ create_proppatch_body(serf_bucket_t **bk
 
 static svn_error_t*
 proppatch_resource(svn_ra_serf__session_t *session,
-                   svn_ra_serf__connection_t *conn,
                    proppatch_context_t *proppatch,
                    apr_pool_t *pool)
 {
   svn_ra_serf__handler_t *handler;
   svn_error_t *err;
 
-  handler = svn_ra_serf__create_handler(pool);
+  handler = svn_ra_serf__create_handler(session, pool);
 
   handler->method = "PROPPATCH";
   handler->path = proppatch->path;
-  handler->conn = conn;
-  handler->session = session;
 
   handler->header_delegate = setup_proppatch_headers;
   handler->header_delegate_baton = proppatch;
@@ -1265,7 +1260,7 @@ open_root(void *edit_baton,
                                  "create-txn-with-props"));
 
       /* Create our activity URL now on the server. */
-      handler = svn_ra_serf__create_handler(scratch_pool);
+      handler = svn_ra_serf__create_handler(commit_ctx->session, scratch_pool);
 
       handler->method = "POST";
       handler->body_type = SVN_SKEL_MIME_TYPE;
@@ -1275,8 +1270,6 @@ open_root(void *edit_baton,
       handler->header_delegate = setup_post_headers;
       handler->header_delegate_baton = NULL;
       handler->path = commit_ctx->session->me_resource;
-      handler->conn = commit_ctx->session->conns[0];
-      handler->session = commit_ctx->session;
 
       prc = apr_pcalloc(scratch_pool, sizeof(*prc));
       prc->handler = handler;
@@ -1337,12 +1330,10 @@ open_root(void *edit_baton,
                                     commit_ctx->pool);
 
       /* Create our activity URL now on the server. */
-      handler = svn_ra_serf__create_handler(scratch_pool);
+      handler = svn_ra_serf__create_handler(commit_ctx->session, scratch_pool);
 
       handler->method = "MKACTIVITY";
       handler->path = commit_ctx->activity_url;
-      handler->conn = commit_ctx->session->conns[0];
-      handler->session = commit_ctx->session;
 
       handler->response_handler = svn_ra_serf__expect_empty_body;
       handler->response_baton = handler;
@@ -1403,7 +1394,6 @@ open_root(void *edit_baton,
         }
 
       SVN_ERR(proppatch_resource(commit_ctx->session,
-                                 commit_ctx->conn,
                                  proppatch_ctx, scratch_pool));
     }
 
@@ -1447,9 +1437,7 @@ delete_entry(const char *path,
   delete_ctx->revision = revision;
   delete_ctx->commit_ctx = dir->commit_ctx;
 
-  handler = svn_ra_serf__create_handler(pool);
-  handler->session = dir->commit_ctx->session;
-  handler->conn = dir->commit_ctx->conn;
+  handler = svn_ra_serf__create_handler(dir->commit_ctx->session, pool);
 
   handler->response_handler = svn_ra_serf__expect_empty_body;
   handler->response_baton = handler;
@@ -1517,9 +1505,7 @@ add_directory(const char *path,
                                dir->name, dir->pool);
     }
 
-  handler = svn_ra_serf__create_handler(dir->pool);
-  handler->conn = dir->commit_ctx->conn;
-  handler->session = dir->commit_ctx->session;
+  handler = svn_ra_serf__create_handler(dir->commit_ctx->session, dir->pool);
 
   handler->response_handler = svn_ra_serf__expect_empty_body;
   handler->response_baton = handler;
@@ -1665,7 +1651,6 @@ close_directory(void *dir_baton,
         }
 
       SVN_ERR(proppatch_resource(dir->commit_ctx->session,
-                                 dir->commit_ctx->conn,
                                  proppatch_ctx, dir->pool));
     }
 
@@ -1747,11 +1732,10 @@ add_file(const char *path,
                                           uri.path, copy_revision,
                                           scratch_pool, scratch_pool));
 
-      handler = svn_ra_serf__create_handler(scratch_pool);
+      handler = svn_ra_serf__create_handler(dir->commit_ctx->session,
+                                            scratch_pool);
       handler->method = "COPY";
       handler->path = req_url;
-      handler->conn = dir->commit_ctx->conn;
-      handler->session = dir->commit_ctx->session;
 
       handler->response_handler = svn_ra_serf__expect_empty_body;
       handler->response_baton = handler;
@@ -1770,9 +1754,8 @@ add_file(const char *path,
       svn_ra_serf__handler_t *handler;
       svn_error_t *err;
 
-      handler = svn_ra_serf__create_handler(scratch_pool);
-      handler->session = new_file->commit_ctx->session;
-      handler->conn = new_file->commit_ctx->conn;
+      handler = svn_ra_serf__create_handler(dir->commit_ctx->session,
+                                            scratch_pool);
       handler->method = "HEAD";
       handler->path = svn_path_url_add_component2(
                                         dir->commit_ctx->session->session_url.path,
@@ -1928,12 +1911,11 @@ close_file(void *file_baton,
       svn_ra_serf__handler_t *handler;
       int expected_result;
 
-      handler = svn_ra_serf__create_handler(scratch_pool);
+      handler = svn_ra_serf__create_handler(ctx->commit_ctx->session,
+                                            scratch_pool);
 
       handler->method = "PUT";
       handler->path = ctx->url;
-      handler->conn = ctx->commit_ctx->conn;
-      handler->session = ctx->commit_ctx->session;
 
       handler->response_handler = svn_ra_serf__expect_empty_body;
       handler->response_baton = handler;
@@ -1982,7 +1964,6 @@ close_file(void *file_baton,
       proppatch->base_revision = ctx->base_revision;
 
       SVN_ERR(proppatch_resource(ctx->commit_ctx->session,
-                                 ctx->commit_ctx->conn,
                                  proppatch, scratch_pool));
     }
 
@@ -2015,12 +1996,10 @@ close_edit(void *edit_baton,
     {
       svn_ra_serf__handler_t *handler;
 
-      handler = svn_ra_serf__create_handler(pool);
+      handler = svn_ra_serf__create_handler(ctx->session, pool);
 
       handler->method = "DELETE";
       handler->path = ctx->activity_url;
-      handler->conn = ctx->conn;
-      handler->session = ctx->session;
 
       handler->response_handler = svn_ra_serf__expect_empty_body;
       handler->response_baton = handler;
@@ -2053,11 +2032,9 @@ abort_edit(void *edit_baton,
   serf_connection_reset(ctx->session->conns[0]->conn);
 
   /* DELETE our aborted activity */
-  handler = svn_ra_serf__create_handler(pool);
+  handler = svn_ra_serf__create_handler(ctx->session, pool);
 
   handler->method = "DELETE";
-  handler->conn = ctx->session->conns[0];
-  handler->session = ctx->session;
 
   handler->response_handler = svn_ra_serf__expect_empty_body;
   handler->response_baton = handler;
@@ -2255,9 +2232,7 @@ svn_ra_serf__change_rev_prop(svn_ra_sess
   prop->value = value;
   svn_hash_sets(proppatch_ctx->prop_changes, prop->name, prop);
 
-  err = proppatch_resource(session,
-                           session->conns[0],
-                            proppatch_ctx, pool);
+  err = proppatch_resource(session, proppatch_ctx, pool);
 
   /* Use specific error code for old property value mismatch.
      Use loop to provide the right result with tracing */

Modified: subversion/trunk/subversion/libsvn_ra_serf/get_file.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/get_file.c?rev=1654669&r1=1654668&r2=1654669&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/get_file.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/get_file.c Sun Jan 25 17:13:36 2015
@@ -291,15 +291,11 @@ svn_ra_serf__get_file(svn_ra_session_t *
                       apr_pool_t *pool)
 {
   svn_ra_serf__session_t *session = ra_session->priv;
-  svn_ra_serf__connection_t *conn;
   const char *fetch_url;
   apr_hash_t *fetch_props;
   svn_node_kind_t res_kind;
   const svn_ra_serf__dav_props_t *which_props;
 
-  /* What connection should we go on? */
-  conn = session->conns[session->cur_conn];
-
   /* Fetch properties. */
 
   fetch_url = svn_path_url_add_component2(session->session_url.path, path, pool);
@@ -371,12 +367,13 @@ svn_ra_serf__get_file(svn_ra_session_t *
           stream_ctx->result_stream = stream;
           stream_ctx->using_compression = session->using_compression;
 
-          handler = svn_ra_serf__create_handler(pool);
+          handler = svn_ra_serf__create_handler(session, pool);
+
+          /* What connection should we go on? */
+          handler->conn = session->conns[session->cur_conn];
 
           handler->method = "GET";
           handler->path = fetch_url;
-          handler->conn = conn;
-          handler->session = session;
 
           handler->custom_accept_encoding = TRUE;
           handler->no_dav_headers = TRUE;

Modified: subversion/trunk/subversion/libsvn_ra_serf/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/lock.c?rev=1654669&r1=1654668&r2=1654669&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/lock.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/lock.c Sun Jan 25 17:13:36 2015
@@ -649,12 +649,10 @@ svn_ra_serf__unlock(svn_ra_session_t *ra
       req_url = svn_path_url_add_component2(session->session_url.path, lock_ctx->path,
                                             lock_pool);
 
-      handler = svn_ra_serf__create_handler(lock_pool);
+      handler = svn_ra_serf__create_handler(session, lock_pool);
 
       handler->method = "UNLOCK";
       handler->path = req_url;
-      handler->conn = session->conns[0];
-      handler->session = session;
 
       handler->header_delegate = set_unlock_headers;
       handler->header_delegate_baton = lock_ctx;

Modified: subversion/trunk/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/options.c?rev=1654669&r1=1654668&r2=1654669&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/options.c Sun Jan 25 17:13:36 2015
@@ -566,11 +566,9 @@ svn_ra_serf__probe_proxy(svn_ra_serf__se
 {
   svn_ra_serf__handler_t *handler;
 
-  handler = svn_ra_serf__create_handler(scratch_pool);
+  handler = svn_ra_serf__create_handler(serf_sess, scratch_pool);
   handler->method = "OPTIONS";
   handler->path = serf_sess->session_url.path;
-  handler->conn = serf_sess->conns[0];
-  handler->session = serf_sess;
 
   /* We don't care about the response body, so discard it.  */
   handler->response_handler = svn_ra_serf__handle_discard_body;

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=1654669&r1=1654668&r2=1654669&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Sun Jan 25 17:13:36 2015
@@ -639,9 +639,11 @@ typedef struct svn_ra_serf__xml_transiti
 
 } svn_ra_serf__xml_transition_t;
 
-/* Constructor for */
+/* Constructor for svn_ra_serf__handler_t. Initializes a new handler
+   with default settings for SESSION. */
 svn_ra_serf__handler_t *
-svn_ra_serf__create_handler(apr_pool_t *result_pool);
+svn_ra_serf__create_handler(svn_ra_serf__session_t *session,
+                            apr_pool_t *result_pool);
 
 /* Construct an XML parsing context, based on the TTABLE transition table.
    As content is parsed, the CLOSED_CB callback will be invoked according

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1654669&r1=1654668&r2=1654669&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Sun Jan 25 17:13:36 2015
@@ -1461,13 +1461,12 @@ fetch_for_file(file_baton_t *file,
                                         : NULL;
             }
 
-          handler = svn_ra_serf__create_handler(file->pool);
+          handler = svn_ra_serf__create_handler(ctx->sess, file->pool);
 
           handler->method = "GET";
           handler->path = file->url;
 
-          handler->conn = conn;
-          handler->session = ctx->sess;
+          handler->conn = conn; /* Explicit scheduling */
 
           handler->custom_accept_encoding = TRUE;
           handler->no_dav_headers = TRUE;
@@ -1500,7 +1499,7 @@ fetch_for_file(file_baton_t *file,
                                                    all_props,
                                                    set_file_props, file,
                                                    file->pool));
-      file->propfind_handler->conn = conn;
+      file->propfind_handler->conn = conn; /* Explicit scheduling */
 
       file->propfind_handler->done_delegate = file_props_done;
       file->propfind_handler->done_delegate_baton = file;

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1654669&r1=1654668&r2=1654669&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Sun Jan 25 17:13:36 2015
@@ -1878,7 +1878,8 @@ handler_cleanup(void *baton)
 }
 
 svn_ra_serf__handler_t *
-svn_ra_serf__create_handler(apr_pool_t *result_pool)
+svn_ra_serf__create_handler(svn_ra_serf__session_t *session,
+                            apr_pool_t *result_pool)
 {
   svn_ra_serf__handler_t *handler;
 
@@ -1888,6 +1889,9 @@ svn_ra_serf__create_handler(apr_pool_t *
   apr_pool_cleanup_register(result_pool, handler, handler_cleanup,
                             apr_pool_cleanup_null);
 
+  handler->session = session;
+  handler->conn = session->conns[0];
+
   /* Setup the default done handler, to handle server errors */
   handler->done_delegate_baton = handler;
   handler->done_delegate = response_done;

Modified: subversion/trunk/subversion/libsvn_ra_serf/xml.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/xml.c?rev=1654669&r1=1654668&r2=1654669&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/xml.c Sun Jan 25 17:13:36 2015
@@ -1101,13 +1101,10 @@ svn_ra_serf__create_expat_handler(svn_ra
   ectx->expected_status = expected_status;
   ectx->cleanup_pool = result_pool;
 
-  handler = svn_ra_serf__create_handler(result_pool);
+  handler = svn_ra_serf__create_handler(session, result_pool);
   handler->response_handler = expat_response_handler;
   handler->response_baton = ectx;
 
-  handler->session = session;
-  handler->conn = session->conns[0];
-
   ectx->handler = handler;
 
   return handler;