forked from alibaba/nginx-tfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathngx_http_connection_pool.h
53 lines (36 loc) · 1.32 KB
/
ngx_http_connection_pool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright (C) 2010-2012 Alibaba Group Holding Limited
*/
#ifndef _NGX_HTTP_CONNECTION_POOL_H_INCLUDED_
#define _NGX_HTTP_CONNECTION_POOL_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
typedef struct ngx_http_connection_pool_s ngx_http_connection_pool_t;
typedef struct {
ngx_queue_t queue;
ngx_connection_t *connection;
socklen_t socklen;
u_char sockaddr[NGX_SOCKADDRLEN];
ngx_queue_t *free;
} ngx_http_connection_pool_elt_t;
struct ngx_http_connection_pool_s {
ngx_queue_t *cache;
ngx_queue_t *free;
ngx_uint_t max_cached;
ngx_uint_t bucket_count;
ngx_uint_t failed; /* unsigned:1 */
ngx_pool_t *pool;
#if (NGX_DEBUG)
ngx_int_t count; /* check get&free op pairs */
#endif
ngx_event_get_peer_pt get_peer;
ngx_event_free_peer_pt free_peer;
};
ngx_http_connection_pool_t *ngx_http_connection_pool_init(ngx_pool_t *pool,
ngx_uint_t max_count, ngx_uint_t bucket_count);
#if (NGX_DEBUG)
void ngx_http_connection_pool_check(ngx_http_connection_pool_t *coon_pool,
ngx_log_t *log);
#endif
#endif /* _NGX_HTTP_CONNECTION_POOL_H_INCLUDED_ */