Mercurial > hg > nginx-quic
comparison src/http/ngx_http_upstream.h @ 884:4d68c486fcb0
upstream choice modules
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 04 Dec 2006 16:46:13 +0000 |
parents | e924670896ab |
children | a9a7e4b1a72b |
comparison
equal
deleted
inserted
replaced
883:eac23634d614 | 884:4d68c486fcb0 |
---|---|
42 | 42 |
43 | 43 |
44 typedef struct { | 44 typedef struct { |
45 ngx_hash_t headers_in_hash; | 45 ngx_hash_t headers_in_hash; |
46 ngx_array_t upstreams; | 46 ngx_array_t upstreams; |
47 /* ngx_http_upstream_srv_conf_t */ | 47 /* ngx_http_upstream_srv_conf_t */ |
48 } ngx_http_upstream_main_conf_t; | 48 } ngx_http_upstream_main_conf_t; |
49 | 49 |
50 | 50 typedef struct ngx_http_upstream_srv_conf_s ngx_http_upstream_srv_conf_t; |
51 typedef struct { | 51 |
52 ngx_peers_t *peers; | 52 typedef ngx_int_t (*ngx_http_upstream_init_pt)(ngx_conf_t *cf, |
53 | 53 ngx_http_upstream_srv_conf_t *us); |
54 ngx_array_t *servers; | 54 typedef ngx_int_t (*ngx_http_upstream_init_peer_pt)(ngx_http_request_t *r, |
55 | 55 ngx_http_upstream_srv_conf_t *us); |
56 | |
57 | |
58 typedef struct { | |
59 ngx_http_upstream_init_pt init_upstream; | |
60 ngx_http_upstream_init_peer_pt init; | |
61 void *data; | |
62 } ngx_http_upstream_peer_t; | |
63 | |
64 | |
65 typedef struct { | |
66 ngx_peer_addr_t *addrs; | |
67 ngx_uint_t naddrs; | |
68 ngx_uint_t weight; | |
69 ngx_uint_t max_fails; | |
70 time_t fail_timeout; | |
71 | |
72 unsigned down:1; | |
73 unsigned backup:1; | |
74 } ngx_http_upstream_server_t; | |
75 | |
76 | |
77 #define NGX_HTTP_UPSTREAM_CREATE 0x0001 | |
78 #define NGX_HTTP_UPSTREAM_WEIGHT 0x0002 | |
79 #define NGX_HTTP_UPSTREAM_MAX_FAILS 0x0004 | |
80 #define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT 0x0008 | |
81 #define NGX_HTTP_UPSTREAM_DOWN 0x0010 | |
82 #define NGX_HTTP_UPSTREAM_BACKUP 0x0020 | |
83 | |
84 | |
85 struct ngx_http_upstream_srv_conf_s { | |
86 ngx_http_upstream_peer_t peer; | |
87 void **srv_conf; | |
88 | |
89 ngx_array_t *servers; /* ngx_http_upstream_server_t */ | |
90 | |
91 ngx_uint_t flags; | |
56 ngx_str_t host; | 92 ngx_str_t host; |
57 ngx_str_t file_name; | 93 ngx_str_t file_name; |
58 ngx_uint_t line; | 94 ngx_uint_t line; |
59 in_port_t port; | 95 in_port_t port; |
60 } ngx_http_upstream_srv_conf_t; | 96 }; |
61 | 97 |
62 | 98 |
63 typedef struct { | 99 typedef struct { |
100 ngx_http_upstream_srv_conf_t *upstream; | |
101 | |
64 ngx_msec_t connect_timeout; | 102 ngx_msec_t connect_timeout; |
65 ngx_msec_t send_timeout; | 103 ngx_msec_t send_timeout; |
66 ngx_msec_t read_timeout; | 104 ngx_msec_t read_timeout; |
67 ngx_msec_t timeout; | 105 ngx_msec_t timeout; |
68 | 106 |
76 size_t busy_buffers_size_conf; | 114 size_t busy_buffers_size_conf; |
77 size_t max_temp_file_size_conf; | 115 size_t max_temp_file_size_conf; |
78 size_t temp_file_write_size_conf; | 116 size_t temp_file_write_size_conf; |
79 | 117 |
80 ngx_uint_t next_upstream; | 118 ngx_uint_t next_upstream; |
81 ngx_uint_t max_fails; | |
82 | |
83 time_t fail_timeout; | |
84 | 119 |
85 ngx_bufs_t bufs; | 120 ngx_bufs_t bufs; |
86 | 121 |
87 ngx_flag_t buffering; | 122 ngx_flag_t buffering; |
88 ngx_flag_t pass_request_headers; | 123 ngx_flag_t pass_request_headers; |
211 }; | 246 }; |
212 | 247 |
213 | 248 |
214 void ngx_http_upstream_init(ngx_http_request_t *r); | 249 void ngx_http_upstream_init(ngx_http_request_t *r); |
215 ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf, | 250 ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf, |
216 ngx_url_t *u); | 251 ngx_url_t *u, ngx_uint_t flags); |
252 | |
253 | |
254 #define ngx_http_conf_upstream_srv_conf(uscf, module) \ | |
255 uscf->srv_conf[module.ctx_index] | |
217 | 256 |
218 | 257 |
219 extern ngx_module_t ngx_http_upstream_module; | 258 extern ngx_module_t ngx_http_upstream_module; |
220 | 259 |
221 | 260 |