comparison ngx_http_upstream_keepalive_module.c @ 5:e7d1b49e0611

Keepalive: style.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 23 Oct 2008 19:18:36 +0400
parents e18e4613b841
children bef88ba0b378
comparison
equal deleted inserted replaced
4:e18e4613b841 5:e7d1b49e0611
5 5
6 6
7 #include <ngx_config.h> 7 #include <ngx_config.h>
8 #include <ngx_core.h> 8 #include <ngx_core.h>
9 #include <ngx_http.h> 9 #include <ngx_http.h>
10
10 11
11 typedef struct { 12 typedef struct {
12 ngx_queue_t queue; 13 ngx_queue_t queue;
13 ngx_connection_t *connection; 14 ngx_connection_t *connection;
14 } ngx_http_upstream_keepalive_cache_t; 15 } ngx_http_upstream_keepalive_cache_t;
15 16
17
16 typedef struct { 18 typedef struct {
17 ngx_uint_t max_cached; 19 ngx_uint_t max_cached;
18 20
19 ngx_queue_t cache; 21 ngx_queue_t cache;
20 ngx_queue_t free; 22 ngx_queue_t free;
21 23
22 ngx_http_upstream_init_pt original_init_upstream; 24 ngx_http_upstream_init_pt original_init_upstream;
23 ngx_http_upstream_init_peer_pt original_init_peer; 25 ngx_http_upstream_init_peer_pt original_init_peer;
24 26
25 } ngx_http_upstream_keepalive_srv_conf_t; 27 } ngx_http_upstream_keepalive_srv_conf_t;
28
26 29
27 typedef struct { 30 typedef struct {
28 ngx_http_upstream_keepalive_srv_conf_t *conf; 31 ngx_http_upstream_keepalive_srv_conf_t *conf;
29 32
30 void *data; 33 void *data;
42 static void ngx_http_upstream_free_keepalive_peer(ngx_peer_connection_t *pc, 45 static void ngx_http_upstream_free_keepalive_peer(ngx_peer_connection_t *pc,
43 void *data, ngx_uint_t state); 46 void *data, ngx_uint_t state);
44 47
45 static void ngx_http_upstream_keepalive_dummy_handler(ngx_event_t *ev); 48 static void ngx_http_upstream_keepalive_dummy_handler(ngx_event_t *ev);
46 static void ngx_http_upstream_keepalive_close_handler(ngx_event_t *ev); 49 static void ngx_http_upstream_keepalive_close_handler(ngx_event_t *ev);
47
48 50
49 static void *ngx_http_upstream_keepalive_create_conf(ngx_conf_t *cf); 51 static void *ngx_http_upstream_keepalive_create_conf(ngx_conf_t *cf);
50 static char *ngx_http_upstream_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, 52 static char *ngx_http_upstream_keepalive(ngx_conf_t *cf, ngx_command_t *cmd,
51 void *conf); 53 void *conf);
52 54
176 { 178 {
177 ngx_http_upstream_keepalive_peer_data_t *kp = data; 179 ngx_http_upstream_keepalive_peer_data_t *kp = data;
178 ngx_http_upstream_keepalive_cache_t *item; 180 ngx_http_upstream_keepalive_cache_t *item;
179 181
180 ngx_queue_t *q; 182 ngx_queue_t *q;
181 ngx_connection_t *c; 183 ngx_connection_t *c;
182 184
183 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0, 185 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0,
184 "get keepalive peer"); 186 "get keepalive peer");
185 187
186 /* XXX single pool of cached connections */ 188 /* XXX single pool of cached connections */