Go to the source code of this file.
Data Structures | |
struct | ngx_connection_pool_s |
Structure containing connection pool specyfic data, returned by ngx_connection_pool_create. More... | |
struct | ngx_pooled_connection_s |
Structure containing single connection pooled. More... | |
Typedefs | |
typedef typedef struct ngx_connection_pool_s | ngx_connection_pool_t |
typedef struct ngx_pooled_connection_s | ngx_pooled_connection_t |
Functions | |
ngx_connection_pool_t * | ngx_connection_pool_create (ngx_log_t *_log, struct sockaddr_in *_sockaddr, ngx_uint_t _sockaddr_size, ngx_uint_t _stored_connections_limit) |
Creates new pool. | |
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) |
Returns connection to pool. | |
void | ngx_connection_pool_release (ngx_pooled_connection_t *connection) |
Frees connection without returning it to pool. |
typedef typedef struct ngx_connection_pool_s ngx_connection_pool_t |
Definition at line 23 of file ngx_connection_pool.h.
typedef struct ngx_pooled_connection_s ngx_pooled_connection_t |
Definition at line 24 of file ngx_connection_pool.h.
ngx_connection_pool_t* ngx_connection_pool_create | ( | ngx_log_t * | _log, | |
struct sockaddr_in * | _sockaddr, | |||
ngx_uint_t | _sockaddr_size, | |||
ngx_uint_t | _stored_connections_limit | |||
) |
Creates new pool.
[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 |
Definition at line 40 of file ngx_connection_pool.c.
References ngx_connecton_pool_pcounter.
Referenced by ngx_http_mxcache_merge_conf().
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.
[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) |
Definition at line 200 of file ngx_connection_pool.c.
References ngx_connection_pool_get_new(), ngx_connection_pool_release(), and ngx_connection_pool_strip_broken().
Referenced by ngx_http_mxcache_init_conn().
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.
[in] | connection | pool connection to be freed. |
Definition at line 445 of file ngx_connection_pool.c.
References ngx_pooled_connection_s::connection, ngx_pooled_connection_s::owner_pool, and ngx_pooled_connection_s::pool.
Referenced by ngx_connection_pool_get(), ngx_connection_pool_return(), and ngx_http_mxcache_finalize_connection().
void ngx_connection_pool_return | ( | ngx_pooled_connection_t * | connection | ) |
Returns connection to pool.
It will be released from ngix structures
[in] | connection | pool connection to return to pool. |
Definition at line 329 of file ngx_connection_pool.c.
References ngx_pooled_connection_s::connection, ngx_pooled_connection_s::data, ngx_pooled_connection_s::fd, ngx_pooled_connection_s::next, ngx_connection_pool_release(), ngx_pooled_connection_s::owner_pool, and ngx_pooled_connection_s::previous.
Referenced by ngx_http_mxcache_finalize_connection().