You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2010/06/16 19:48:42 UTC
svn commit: r955326 - in /subversion/trunk/subversion/libsvn_ra_serf:
ra_serf.h util.c
Author: ivan
Date: Wed Jun 16 17:48:41 2010
New Revision: 955326
URL: http://svn.apache.org/viewvc?rev=955326&view=rev
Log:
Remove support for taking snapshots of request body buckets. We always use
delegate to create bucket on demand when needed.
* subversion/libsvn_ra_serf/ra_serf.h
(svn_ra_serf__handler_t): Remove body_buckets member and document that
body_delegate can be NULL.
* subversion/libsvn_ra_serf/util.c
(handle_response, setup_request): Remove support for taking snapshots of
request body buckets.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
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=955326&r1=955325&r2=955326&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Wed Jun 16 17:48:41 2010
@@ -473,18 +473,6 @@ typedef struct {
/* The resource to the execute the method on. */
const char *path;
- /* The request's body buckets.
- *
- * May be NULL if there is no body to send or ->body_delegate is set.
- *
- * Using the body_delegate function is preferred as it delays the
- * creation of the body until we're about to deliver the request
- * instead of creating it earlier.
- *
- * @see svn_ra_serf__request_body_delegate_t
- */
- serf_bucket_t *body_buckets;
-
/* The content-type of the request body. */
const char *body_type;
@@ -522,6 +510,9 @@ typedef struct {
*
* It will be executed after the request has been set up but before it is
* delivered.
+ *
+ * May be NULL if there is no body to send.
+ *
*/
svn_ra_serf__request_body_delegate_t body_delegate;
void *body_delegate_baton;
@@ -529,9 +520,6 @@ typedef struct {
/* The connection and session to be used for this request. */
svn_ra_serf__connection_t *conn;
svn_ra_serf__session_t *session;
-
- /* Marks whether a snapshot was set on the body bucket. */
- svn_boolean_t body_snapshot_set;
} svn_ra_serf__handler_t;
/*
Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=955326&r1=955325&r2=955326&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Wed Jun 16 17:48:41 2010
@@ -1255,10 +1255,6 @@ svn_ra_serf__credentials_callback(char *
response status and headers, and invoke CTX->response_handler() to
carry out operation-specific processing. Afterwards, check for
connection close.
-
- If during the setup of the request we set a snapshot on the body buckets,
- handle_response has to make sure these buckets get destroyed iff the
- request doesn't have to be resent.
*/
static apr_status_t
handle_response(serf_request_t *request,
@@ -1439,15 +1435,6 @@ handle_response(serf_request_t *request,
}
cleanup:
- /* If a snapshot was set on the body bucket, it wasn't destroyed when the
- request was sent, we have to destroy it now upon successful handling of
- the response. */
- if (ctx->body_snapshot_set && ctx->body_buckets)
- {
- serf_bucket_destroy(ctx->body_buckets);
- ctx->body_buckets = NULL;
- ctx->body_snapshot_set = FALSE;
- }
return status;
}
@@ -1496,7 +1483,8 @@ setup_request(serf_request_t *request,
}
else
{
- serf_bucket_t *body_bkt = ctx->body_buckets;
+ serf_bucket_t *body_bkt;
+ serf_bucket_alloc_t *bkt_alloc = serf_request_get_alloc(request);
if (strcmp(ctx->method, "HEAD") == 0)
{
@@ -1505,49 +1493,13 @@ setup_request(serf_request_t *request,
if (ctx->body_delegate)
{
- body_bkt = ctx->body_buckets =
- ctx->body_delegate(ctx->body_delegate_baton,
- serf_request_get_alloc(request),
- pool);
- }
- /* If this is a request that has to be retried, we might be able to reuse
- the existing body buckets if a snapshot was set. */
- else if (ctx->body_buckets)
- {
- /* Wrap the body bucket in a barrier bucket if a snapshot was set.
- After the request is sent serf will destroy the request bucket
- (req_bkt) including this barrier bucket, but this way our
- body_buckets bucket will not be destroyed and we can reuse it
- later.
- This does put ownership of body_buckets in our own hands though,
- so we have to make sure it gets destroyed when handling the
- response. */
- /* TODO: for now we assume restoring a snapshot on a bucket that
- hasn't been read yet is a cheap operation. We need a way to find
- out if we really need to restore a snapshot, or if we still are
- in the initial state. */
- apr_status_t status;
- if (ctx->body_snapshot_set)
- {
- /* If restoring a snapshot doesn't work, we have to fall back
- on current behavior (ie. retrying a request fails). */
- status = serf_bucket_restore_snapshot(ctx->body_buckets);
- }
- status = serf_bucket_snapshot(ctx->body_buckets);
- if (status == APR_SUCCESS)
- {
- ctx->body_snapshot_set = TRUE;
- body_bkt = serf_bucket_barrier_create(ctx->body_buckets,
- serf_request_get_alloc(request));
- }
- else
- {
- /* If the snapshot wasn't successful (maybe because the caller
- used a bucket that doesn't support the snapshot feature),
- fall back to non-snapshot behavior and hope that the request
- is handled the first time. */
- }
- }
+ body_bkt =
+ ctx->body_delegate(ctx->body_delegate_baton, bkt_alloc, pool);
+ }
+ else
+ {
+ body_bkt = NULL;
+ }
svn_ra_serf__setup_serf_req(request, req_bkt, &headers_bkt, ctx->conn,
ctx->method, ctx->path,