FreeBSD/contrib/subversion/subversion/libsvn_ra_serf/update.c
/* Process the 'update' editor report */
Process the 'update' editor report
Process the ' update ' editor report
static svn_error_t *
process_editor_report(report_context_t *ctx,
                      svn_ra_serf__handler_t *handler,
                      apr_pool_t *scratch_pool)
{
  svn_ra_serf__session_t *sess = ctx->sess;
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
  apr_interval_time_t waittime_left = sess->timeout;
  update_delay_baton_t *ud;
  ud = apr_pcalloc(scratch_pool, sizeof(*ud));
  ud->report = ctx;
  ud->inner_handler = handler->response_handler;
  ud->inner_handler_baton = handler->response_baton;
  handler->response_handler = update_delay_handler;
  handler->response_baton = ud;
  SVN_ERR(open_connection_if_needed(sess, 0));
  sess->cur_conn = 1;
  while (!handler->done
         || ctx->num_active_fetches
         || ctx->num_active_propfinds
         || !ctx->done)
    {
      svn_error_t *err;
      int i;
      svn_pool_clear(iterpool);
      err = svn_ra_serf__context_run(sess, &waittime_left, iterpool);
      if (handler->done && handler->server_error)
        {
          svn_error_clear(err);
          err = svn_ra_serf__server_error_create(handler, iterpool);
          SVN_ERR_ASSERT(err != NULL);
        }
      SVN_ERR(err);
      if (ud->spillbuf)
        SVN_ERR(process_pending(ud, iterpool));
      for (i = 0; i < sess->num_conns; i++)
        {
          serf_debug__closed_conn(sess->conns[i]->bkt_alloc);
        }
    }
  svn_pool_clear(iterpool);
  if (ctx->done)
    SVN_ERR(ctx->editor->close_edit(ctx->editor_baton, iterpool));
  else
    return svn_error_create(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
                            _("Missing update-report close tag"));
  svn_pool_destroy(iterpool);
  return SVN_NO_ERROR;
}
static svn_error_t * process_editor_report ( report_context_t * ctx , svn_ra_serf__handler_t * handler , apr_pool_t * scratch_pool ) { svn_ra_serf__session_t * sess = ctx -> sess ; apr_pool_t * iterpool = svn_pool_create ( scratch_pool ) ; apr_interval_time_t waittime_left = sess -> timeout ; update_delay_baton_t * ud ; ud = apr_pcalloc ( scratch_pool , sizeof ( * ud ) ) ; ud -> report = ctx ; ud -> inner_handler = handler -> response_handler ; ud -> inner_handler_baton = handler -> response_baton ; handler -> response_handler = update_delay_handler ; handler -> response_baton = ud ; SVN_ERR ( open_connection_if_needed ( sess , 0 ) ) ; sess -> cur_conn = 1 ; while ( ! handler -> done || ctx -> num_active_fetches || ctx -> num_active_propfinds || ! ctx -> done ) { svn_error_t * err ; int i ; svn_pool_clear ( iterpool ) ; err = svn_ra_serf__context_run ( sess , & waittime_left , iterpool ) ; if ( handler -> done && handler -> server_error ) { svn_error_clear ( err ) ; err = svn_ra_serf__server_error_create ( handler , iterpool ) ; SVN_ERR_ASSERT ( err != NULL ) ; } SVN_ERR ( err ) ; if ( ud -> spillbuf ) SVN_ERR ( process_pending ( ud , iterpool ) ) ; for ( i = 0 ; i < sess -> num_conns ; i ++ ) { serf_debug__closed_conn ( sess -> conns [ i ] -> bkt_alloc ) ; } } svn_pool_clear ( iterpool ) ; if ( ctx -> done ) SVN_ERR ( ctx -> editor -> close_edit ( ctx -> editor_baton , iterpool ) ) ; else return svn_error_create ( SVN_ERR_RA_DAV_MALFORMED_DATA , NULL , _ ( " " ) ) ; svn_pool_destroy ( iterpool ) ; return SVN_NO_ERROR ; }
Process the 'update' editor report
Process the ' update ' editor report
/* Now wrap the response handler with delay support to avoid sending
     out too many requests at once */ /* Open the first extra connection. */ /* Note that we may have no active GET or PROPFIND requests, yet the
     processing has not been completed. This could be from a delay on the
     network or because we've spooled the entire response into our "pending"
     content of the XML parser. The DONE flag will get set when all the
     XML content has been received *and* parsed.  */ /* If there is pending REPORT data, process it now. */ /* Debugging purposes only! */ /* If we got a complete report, close the edit.  Otherwise, abort it. */