FreeBSD/contrib/subversion/subversion/libsvn_ra_serf/update.c
/** This function creates a new connection for this serf session, but only
 * if the number of NUM_ACTIVE_REQS > REQS_PER_CONN or if there currently is
 * only one main connection open.
 */
This function creates a new connection for this serf session, but only
if the number of NUM_ACTIVE_REQS > REQS_PER_CONN or if there currently is
only one main connection open.
This function creates a new connection for this serf session but only if the number of NUM_ACTIVE_REQS > REQS_PER_CONN or if there currently is only one main connection open .
static svn_error_t *
open_connection_if_needed(svn_ra_serf__session_t *sess, int num_active_reqs)
{
  if (sess->num_conns == 1 ||
      ((num_active_reqs / REQS_PER_CONN) > sess->num_conns))
    {
      int cur = sess->num_conns;
      apr_status_t status;
      sess->conns[cur] = apr_pcalloc(sess->pool, sizeof(*sess->conns[cur]));
      sess->conns[cur]->bkt_alloc = serf_bucket_allocator_create(sess->pool,
                                                                 NULL, NULL);
      sess->conns[cur]->last_status_code = -1;
      sess->conns[cur]->session = sess;
      status = serf_connection_create2(&sess->conns[cur]->conn,
                                       sess->context,
                                       sess->session_url,
                                       svn_ra_serf__conn_setup,
                                       sess->conns[cur],
                                       svn_ra_serf__conn_closed,
                                       sess->conns[cur],
                                       sess->pool);
      if (status)
        return svn_ra_serf__wrap_err(status, NULL);
      sess->num_conns++;
    }
  return SVN_NO_ERROR;
}
static svn_error_t * open_connection_if_needed ( svn_ra_serf__session_t * sess , int num_active_reqs ) { if ( sess -> num_conns == 1 || ( ( num_active_reqs / REQS_PER_CONN ) > sess -> num_conns ) ) { int cur = sess -> num_conns ; apr_status_t status ; sess -> conns [ cur ] = apr_pcalloc ( sess -> pool , sizeof ( * sess -> conns [ cur ] ) ) ; sess -> conns [ cur ] -> bkt_alloc = serf_bucket_allocator_create ( sess -> pool , NULL , NULL ) ; sess -> conns [ cur ] -> last_status_code = -1 ; sess -> conns [ cur ] -> session = sess ; status = serf_connection_create2 ( & sess -> conns [ cur ] -> conn , sess -> context , sess -> session_url , svn_ra_serf__conn_setup , sess -> conns [ cur ] , svn_ra_serf__conn_closed , sess -> conns [ cur ] , sess -> pool ) ; if ( status ) return svn_ra_serf__wrap_err ( status , NULL ) ; sess -> num_conns ++ ; } return SVN_NO_ERROR ; }
This function creates a new connection for this serf session, but only
 if the number of NUM_ACTIVE_REQS > REQS_PER_CONN or if there currently is
 only one main connection open.
This function creates a new connection for this serf session but only if the number of NUM_ACTIVE_REQS > REQS_PER_CONN or if there currently is only one main connection open .
/* For each REQS_PER_CONN outstanding requests open a new connection, with
   * a minimum of 1 extra connection. */