ngx_connection_pool.c File Reference

#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <nginx.h>
#include <ngx_log.h>
#include "ngx_connection_pool.h"

Defines

#define testbufflen   5

Functions

ngx_connection_pool_tngx_connection_pool_create (ngx_log_t *_log, struct sockaddr *_sockaddr, ngx_uint_t _sockaddr_size, ngx_uint_t _stored_connections_limit)
 Creates new pool.
static void ngx_connection_pool_strip_broken (ngx_connection_pool_t *pool)
static ngx_int_t ngx_connection_pool_get_new (ngx_connection_pool_t *pool, ngx_pooled_connection_t **new_connection)
ngx_int_t ngx_connection_pool_get (ngx_connection_pool_t *pool, ngx_pooled_connection_t **new_connection, ngx_int_t force_new)
 Fetchs connection from pool.
void ngx_connection_pool_return (ngx_pooled_connection_t *connection_context)
 Returns connection to pool. It will be released from ngix structures.
void ngx_connection_pool_release (ngx_pooled_connection_t *connection_context)
 Frees connection without returning it to pool. Must be used if connection has already failed. Do not return broken connections to pool.

Variables

ngx_atomic_t connecton_pool_pcounter = 1
ngx_atomic_t * ngx_connecton_pool_pcounter = &connecton_pool_pcounter

Define Documentation

#define testbufflen   5


Function Documentation

ngx_connection_pool_t* ngx_connection_pool_create ( ngx_log_t *  _log,
struct sockaddr *  _sockaddr,
ngx_uint_t  _sockaddr_size,
ngx_uint_t  _stored_connections_limit 
)

Creates new pool.

Parameters:
[in] _log used to log errors, passed as log parameter when creating new connections
[in] _sockaddr sockaddr structure used by connect
[in] _sockaddr_size size of _sockaddr
[in] _stored_connections_limit Limit for count of connection created. If more connection are needed NGX_ERROR is returned
Returns:
new connection structure

ngx_int_t ngx_connection_pool_get ( ngx_connection_pool_t pool,
ngx_pooled_connection_t **  new_connection,
ngx_int_t  force_new 
)

Fetchs connection from pool.

Parameters:
[in] pool pool from which connection will be fetched
[out] new_connection pointer where to store new connection
[in] force_new if set to 1, new connection will always be created (even if there are some connections stored)
Returns:
error code (NGX_OK or NGX_ERROR)

static ngx_int_t ngx_connection_pool_get_new ( ngx_connection_pool_t pool,
ngx_pooled_connection_t **  new_connection 
) [static]

void ngx_connection_pool_release ( ngx_pooled_connection_t connection  ) 

Frees connection without returning it to pool. Must be used if connection has already failed. Do not return broken connections to pool.

Parameters:
[in] connection pool connection to be freed.

void ngx_connection_pool_return ( ngx_pooled_connection_t connection  ) 

Returns connection to pool. It will be released from ngix structures.

Parameters:
[in] connection pool connection to return to pool.

static void ngx_connection_pool_strip_broken ( ngx_connection_pool_t pool  )  [static]


Variable Documentation

ngx_atomic_t connecton_pool_pcounter = 1


Generated on Thu Oct 22 16:31:17 2009 for Nginx limit related modules by  doxygen 1.5.6