#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <nginx.h>
#include <ngx_log.h>
#include "ngx_connection_pool.h"
Go to the source code of this file.
Defines | |
#define | testbufflen 5 |
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. | |
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. | |
void | ngx_connection_pool_release (ngx_pooled_connection_t *connection_context) |
Frees connection without returning it to pool. | |
Variables | |
ngx_atomic_t | connecton_pool_pcounter = 1 |
ngx_atomic_t * | ngx_connecton_pool_pcounter = &connecton_pool_pcounter |
#define testbufflen 5 |
Referenced by ngx_connection_pool_strip_broken().
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().
static ngx_int_t ngx_connection_pool_get_new | ( | ngx_connection_pool_t * | pool, | |
ngx_pooled_connection_t ** | new_connection | |||
) | [static] |
Definition at line 132 of file ngx_connection_pool.c.
References ngx_pooled_connection_s::data.
Referenced by ngx_connection_pool_get().
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().
static void ngx_connection_pool_strip_broken | ( | ngx_connection_pool_t * | pool | ) | [static] |
Definition at line 76 of file ngx_connection_pool.c.
References ngx_pooled_connection_s::fd, ngx_pooled_connection_s::next, ngx_pooled_connection_s::pool, ngx_pooled_connection_s::previous, and testbufflen.
Referenced by ngx_connection_pool_get().
ngx_atomic_t connecton_pool_pcounter = 1 |
Definition at line 35 of file ngx_connection_pool.c.
ngx_atomic_t* ngx_connecton_pool_pcounter = &connecton_pool_pcounter |
Definition at line 36 of file ngx_connection_pool.c.
Referenced by ngx_connection_pool_create().