Mercurial > hg > nginx
annotate src/stream/ngx_stream_upstream.c @ 6676:df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Fri, 02 Sep 2016 18:27:08 +0300 |
parents | ab9b4fd8c5b7 |
children | c02290241cbe |
rev | line source |
---|---|
6115 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 #include <ngx_stream.h> | |
11 | |
12 | |
6675
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
13 static ngx_int_t ngx_stream_upstream_add_variables(ngx_conf_t *cf); |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
14 static ngx_int_t ngx_stream_upstream_addr_variable(ngx_stream_session_t *s, |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
15 ngx_stream_variable_value_t *v, uintptr_t data); |
6676
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
16 static ngx_int_t ngx_stream_upstream_bytes_variable(ngx_stream_session_t *s, |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
17 ngx_stream_variable_value_t *v, uintptr_t data); |
6675
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
18 |
6115 | 19 static char *ngx_stream_upstream(ngx_conf_t *cf, ngx_command_t *cmd, |
20 void *dummy); | |
21 static char *ngx_stream_upstream_server(ngx_conf_t *cf, ngx_command_t *cmd, | |
22 void *conf); | |
23 static void *ngx_stream_upstream_create_main_conf(ngx_conf_t *cf); | |
24 static char *ngx_stream_upstream_init_main_conf(ngx_conf_t *cf, void *conf); | |
25 | |
26 | |
27 static ngx_command_t ngx_stream_upstream_commands[] = { | |
28 | |
29 { ngx_string("upstream"), | |
30 NGX_STREAM_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE1, | |
31 ngx_stream_upstream, | |
32 0, | |
33 0, | |
34 NULL }, | |
35 | |
36 { ngx_string("server"), | |
37 NGX_STREAM_UPS_CONF|NGX_CONF_1MORE, | |
38 ngx_stream_upstream_server, | |
39 NGX_STREAM_SRV_CONF_OFFSET, | |
40 0, | |
41 NULL }, | |
42 | |
43 ngx_null_command | |
44 }; | |
45 | |
46 | |
47 static ngx_stream_module_t ngx_stream_upstream_module_ctx = { | |
6675
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
48 ngx_stream_upstream_add_variables, /* preconfiguration */ |
6174
68c106e6fa0a
Stream: added postconfiguration method to stream modules.
Vladimir Homutov <vl@nginx.com>
parents:
6115
diff
changeset
|
49 NULL, /* postconfiguration */ |
68c106e6fa0a
Stream: added postconfiguration method to stream modules.
Vladimir Homutov <vl@nginx.com>
parents:
6115
diff
changeset
|
50 |
6115 | 51 ngx_stream_upstream_create_main_conf, /* create main configuration */ |
52 ngx_stream_upstream_init_main_conf, /* init main configuration */ | |
53 | |
54 NULL, /* create server configuration */ | |
6629 | 55 NULL /* merge server configuration */ |
6115 | 56 }; |
57 | |
58 | |
59 ngx_module_t ngx_stream_upstream_module = { | |
60 NGX_MODULE_V1, | |
61 &ngx_stream_upstream_module_ctx, /* module context */ | |
62 ngx_stream_upstream_commands, /* module directives */ | |
63 NGX_STREAM_MODULE, /* module type */ | |
64 NULL, /* init master */ | |
65 NULL, /* init module */ | |
66 NULL, /* init process */ | |
67 NULL, /* init thread */ | |
68 NULL, /* exit thread */ | |
69 NULL, /* exit process */ | |
70 NULL, /* exit master */ | |
71 NGX_MODULE_V1_PADDING | |
72 }; | |
73 | |
74 | |
6675
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
75 static ngx_stream_variable_t ngx_stream_upstream_vars[] = { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
76 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
77 { ngx_string("upstream_addr"), NULL, |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
78 ngx_stream_upstream_addr_variable, 0, |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
79 NGX_STREAM_VAR_NOCACHEABLE, 0 }, |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
80 |
6676
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
81 { ngx_string("upstream_bytes_sent"), NULL, |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
82 ngx_stream_upstream_bytes_variable, 0, |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
83 NGX_STREAM_VAR_NOCACHEABLE, 0 }, |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
84 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
85 { ngx_string("upstream_bytes_received"), NULL, |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
86 ngx_stream_upstream_bytes_variable, 1, |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
87 NGX_STREAM_VAR_NOCACHEABLE, 0 }, |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
88 |
6675
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
89 { ngx_null_string, NULL, NULL, 0, 0, 0 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
90 }; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
91 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
92 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
93 static ngx_int_t |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
94 ngx_stream_upstream_add_variables(ngx_conf_t *cf) |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
95 { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
96 ngx_stream_variable_t *var, *v; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
97 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
98 for (v = ngx_stream_upstream_vars; v->name.len; v++) { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
99 var = ngx_stream_add_variable(cf, &v->name, v->flags); |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
100 if (var == NULL) { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
101 return NGX_ERROR; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
102 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
103 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
104 var->get_handler = v->get_handler; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
105 var->data = v->data; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
106 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
107 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
108 return NGX_OK; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
109 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
110 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
111 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
112 static ngx_int_t |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
113 ngx_stream_upstream_addr_variable(ngx_stream_session_t *s, |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
114 ngx_stream_variable_value_t *v, uintptr_t data) |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
115 { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
116 u_char *p; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
117 size_t len; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
118 ngx_uint_t i; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
119 ngx_stream_upstream_state_t *state; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
120 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
121 v->valid = 1; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
122 v->no_cacheable = 0; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
123 v->not_found = 0; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
124 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
125 if (s->upstream_states == NULL || s->upstream_states->nelts == 0) { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
126 v->not_found = 1; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
127 return NGX_OK; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
128 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
129 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
130 len = 0; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
131 state = s->upstream_states->elts; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
132 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
133 for (i = 0; i < s->upstream_states->nelts; i++) { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
134 if (state[i].peer) { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
135 len += state[i].peer->len; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
136 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
137 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
138 len += 2; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
139 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
140 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
141 p = ngx_pnalloc(s->connection->pool, len); |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
142 if (p == NULL) { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
143 return NGX_ERROR; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
144 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
145 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
146 v->data = p; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
147 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
148 i = 0; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
149 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
150 for ( ;; ) { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
151 if (state[i].peer) { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
152 p = ngx_cpymem(p, state[i].peer->data, state[i].peer->len); |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
153 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
154 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
155 if (++i == s->upstream_states->nelts) { |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
156 break; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
157 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
158 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
159 *p++ = ','; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
160 *p++ = ' '; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
161 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
162 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
163 v->len = p - v->data; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
164 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
165 return NGX_OK; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
166 } |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
167 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6629
diff
changeset
|
168 |
6676
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
169 static ngx_int_t |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
170 ngx_stream_upstream_bytes_variable(ngx_stream_session_t *s, |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
171 ngx_stream_variable_value_t *v, uintptr_t data) |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
172 { |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
173 u_char *p; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
174 size_t len; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
175 ngx_uint_t i; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
176 ngx_stream_upstream_state_t *state; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
177 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
178 v->valid = 1; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
179 v->no_cacheable = 0; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
180 v->not_found = 0; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
181 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
182 if (s->upstream_states == NULL || s->upstream_states->nelts == 0) { |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
183 v->not_found = 1; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
184 return NGX_OK; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
185 } |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
186 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
187 len = s->upstream_states->nelts * (NGX_OFF_T_LEN + 2); |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
188 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
189 p = ngx_pnalloc(s->connection->pool, len); |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
190 if (p == NULL) { |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
191 return NGX_ERROR; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
192 } |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
193 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
194 v->data = p; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
195 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
196 i = 0; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
197 state = s->upstream_states->elts; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
198 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
199 for ( ;; ) { |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
200 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
201 if (data == 1) { |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
202 p = ngx_sprintf(p, "%O", state[i].bytes_received); |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
203 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
204 } else { |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
205 p = ngx_sprintf(p, "%O", state[i].bytes_sent); |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
206 } |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
207 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
208 if (++i == s->upstream_states->nelts) { |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
209 break; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
210 } |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
211 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
212 *p++ = ','; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
213 *p++ = ' '; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
214 } |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
215 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
216 v->len = p - v->data; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
217 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
218 return NGX_OK; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
219 } |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
220 |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
221 |
6115 | 222 static char * |
223 ngx_stream_upstream(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) | |
224 { | |
225 char *rv; | |
226 void *mconf; | |
227 ngx_str_t *value; | |
228 ngx_url_t u; | |
229 ngx_uint_t m; | |
230 ngx_conf_t pcf; | |
231 ngx_stream_module_t *module; | |
232 ngx_stream_conf_ctx_t *ctx, *stream_ctx; | |
233 ngx_stream_upstream_srv_conf_t *uscf; | |
234 | |
235 ngx_memzero(&u, sizeof(ngx_url_t)); | |
236 | |
237 value = cf->args->elts; | |
238 u.host = value[1]; | |
239 u.no_resolve = 1; | |
240 u.no_port = 1; | |
241 | |
242 uscf = ngx_stream_upstream_add(cf, &u, NGX_STREAM_UPSTREAM_CREATE | |
243 |NGX_STREAM_UPSTREAM_WEIGHT | |
244 |NGX_STREAM_UPSTREAM_MAX_FAILS | |
245 |NGX_STREAM_UPSTREAM_FAIL_TIMEOUT | |
246 |NGX_STREAM_UPSTREAM_DOWN | |
247 |NGX_STREAM_UPSTREAM_BACKUP); | |
248 if (uscf == NULL) { | |
249 return NGX_CONF_ERROR; | |
250 } | |
251 | |
252 | |
253 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_stream_conf_ctx_t)); | |
254 if (ctx == NULL) { | |
255 return NGX_CONF_ERROR; | |
256 } | |
257 | |
258 stream_ctx = cf->ctx; | |
259 ctx->main_conf = stream_ctx->main_conf; | |
260 | |
261 /* the upstream{}'s srv_conf */ | |
262 | |
263 ctx->srv_conf = ngx_pcalloc(cf->pool, | |
264 sizeof(void *) * ngx_stream_max_module); | |
265 if (ctx->srv_conf == NULL) { | |
266 return NGX_CONF_ERROR; | |
267 } | |
268 | |
269 ctx->srv_conf[ngx_stream_upstream_module.ctx_index] = uscf; | |
270 | |
271 uscf->srv_conf = ctx->srv_conf; | |
272 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6174
diff
changeset
|
273 for (m = 0; cf->cycle->modules[m]; m++) { |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6174
diff
changeset
|
274 if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) { |
6115 | 275 continue; |
276 } | |
277 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6174
diff
changeset
|
278 module = cf->cycle->modules[m]->ctx; |
6115 | 279 |
280 if (module->create_srv_conf) { | |
281 mconf = module->create_srv_conf(cf); | |
282 if (mconf == NULL) { | |
283 return NGX_CONF_ERROR; | |
284 } | |
285 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6174
diff
changeset
|
286 ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf; |
6115 | 287 } |
288 } | |
289 | |
290 uscf->servers = ngx_array_create(cf->pool, 4, | |
291 sizeof(ngx_stream_upstream_server_t)); | |
292 if (uscf->servers == NULL) { | |
293 return NGX_CONF_ERROR; | |
294 } | |
295 | |
296 | |
297 /* parse inside upstream{} */ | |
298 | |
299 pcf = *cf; | |
300 cf->ctx = ctx; | |
301 cf->cmd_type = NGX_STREAM_UPS_CONF; | |
302 | |
303 rv = ngx_conf_parse(cf, NULL); | |
304 | |
305 *cf = pcf; | |
306 | |
307 if (rv != NGX_CONF_OK) { | |
308 return rv; | |
309 } | |
310 | |
311 if (uscf->servers->nelts == 0) { | |
312 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
313 "no servers are inside upstream"); | |
314 return NGX_CONF_ERROR; | |
315 } | |
316 | |
317 return rv; | |
318 } | |
319 | |
320 | |
321 static char * | |
322 ngx_stream_upstream_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
323 { | |
324 ngx_stream_upstream_srv_conf_t *uscf = conf; | |
325 | |
326 time_t fail_timeout; | |
327 ngx_str_t *value, s; | |
328 ngx_url_t u; | |
329 ngx_int_t weight, max_fails; | |
330 ngx_uint_t i; | |
331 ngx_stream_upstream_server_t *us; | |
332 | |
333 us = ngx_array_push(uscf->servers); | |
334 if (us == NULL) { | |
335 return NGX_CONF_ERROR; | |
336 } | |
337 | |
338 ngx_memzero(us, sizeof(ngx_stream_upstream_server_t)); | |
339 | |
340 value = cf->args->elts; | |
341 | |
342 weight = 1; | |
343 max_fails = 1; | |
344 fail_timeout = 10; | |
345 | |
346 for (i = 2; i < cf->args->nelts; i++) { | |
347 | |
348 if (ngx_strncmp(value[i].data, "weight=", 7) == 0) { | |
349 | |
350 if (!(uscf->flags & NGX_STREAM_UPSTREAM_WEIGHT)) { | |
351 goto not_supported; | |
352 } | |
353 | |
354 weight = ngx_atoi(&value[i].data[7], value[i].len - 7); | |
355 | |
356 if (weight == NGX_ERROR || weight == 0) { | |
357 goto invalid; | |
358 } | |
359 | |
360 continue; | |
361 } | |
362 | |
363 if (ngx_strncmp(value[i].data, "max_fails=", 10) == 0) { | |
364 | |
365 if (!(uscf->flags & NGX_STREAM_UPSTREAM_MAX_FAILS)) { | |
366 goto not_supported; | |
367 } | |
368 | |
369 max_fails = ngx_atoi(&value[i].data[10], value[i].len - 10); | |
370 | |
371 if (max_fails == NGX_ERROR) { | |
372 goto invalid; | |
373 } | |
374 | |
375 continue; | |
376 } | |
377 | |
378 if (ngx_strncmp(value[i].data, "fail_timeout=", 13) == 0) { | |
379 | |
380 if (!(uscf->flags & NGX_STREAM_UPSTREAM_FAIL_TIMEOUT)) { | |
381 goto not_supported; | |
382 } | |
383 | |
384 s.len = value[i].len - 13; | |
385 s.data = &value[i].data[13]; | |
386 | |
387 fail_timeout = ngx_parse_time(&s, 1); | |
388 | |
389 if (fail_timeout == (time_t) NGX_ERROR) { | |
390 goto invalid; | |
391 } | |
392 | |
393 continue; | |
394 } | |
395 | |
396 if (ngx_strcmp(value[i].data, "backup") == 0) { | |
397 | |
398 if (!(uscf->flags & NGX_STREAM_UPSTREAM_BACKUP)) { | |
399 goto not_supported; | |
400 } | |
401 | |
402 us->backup = 1; | |
403 | |
404 continue; | |
405 } | |
406 | |
407 if (ngx_strcmp(value[i].data, "down") == 0) { | |
408 | |
409 if (!(uscf->flags & NGX_STREAM_UPSTREAM_DOWN)) { | |
410 goto not_supported; | |
411 } | |
412 | |
413 us->down = 1; | |
414 | |
415 continue; | |
416 } | |
417 | |
418 goto invalid; | |
419 } | |
420 | |
421 ngx_memzero(&u, sizeof(ngx_url_t)); | |
422 | |
423 u.url = value[1]; | |
424 | |
425 if (ngx_parse_url(cf->pool, &u) != NGX_OK) { | |
426 if (u.err) { | |
427 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
428 "%s in upstream \"%V\"", u.err, &u.url); | |
429 } | |
430 | |
431 return NGX_CONF_ERROR; | |
432 } | |
433 | |
434 if (u.no_port) { | |
435 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
436 "no port in upstream \"%V\"", &u.url); | |
437 return NGX_CONF_ERROR; | |
438 } | |
439 | |
440 us->name = u.url; | |
441 us->addrs = u.addrs; | |
442 us->naddrs = u.naddrs; | |
443 us->weight = weight; | |
444 us->max_fails = max_fails; | |
445 us->fail_timeout = fail_timeout; | |
446 | |
447 return NGX_CONF_OK; | |
448 | |
449 invalid: | |
450 | |
451 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
452 "invalid parameter \"%V\"", &value[i]); | |
453 | |
454 return NGX_CONF_ERROR; | |
455 | |
456 not_supported: | |
457 | |
458 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
459 "balancing method does not support parameter \"%V\"", | |
460 &value[i]); | |
461 | |
462 return NGX_CONF_ERROR; | |
463 } | |
464 | |
465 | |
466 ngx_stream_upstream_srv_conf_t * | |
467 ngx_stream_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags) | |
468 { | |
469 ngx_uint_t i; | |
470 ngx_stream_upstream_server_t *us; | |
471 ngx_stream_upstream_srv_conf_t *uscf, **uscfp; | |
472 ngx_stream_upstream_main_conf_t *umcf; | |
473 | |
474 if (!(flags & NGX_STREAM_UPSTREAM_CREATE)) { | |
475 | |
476 if (ngx_parse_url(cf->pool, u) != NGX_OK) { | |
477 if (u->err) { | |
478 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
479 "%s in upstream \"%V\"", u->err, &u->url); | |
480 } | |
481 | |
482 return NULL; | |
483 } | |
484 } | |
485 | |
486 umcf = ngx_stream_conf_get_module_main_conf(cf, ngx_stream_upstream_module); | |
487 | |
488 uscfp = umcf->upstreams.elts; | |
489 | |
490 for (i = 0; i < umcf->upstreams.nelts; i++) { | |
491 | |
492 if (uscfp[i]->host.len != u->host.len | |
493 || ngx_strncasecmp(uscfp[i]->host.data, u->host.data, u->host.len) | |
494 != 0) | |
495 { | |
496 continue; | |
497 } | |
498 | |
499 if ((flags & NGX_STREAM_UPSTREAM_CREATE) | |
500 && (uscfp[i]->flags & NGX_STREAM_UPSTREAM_CREATE)) | |
501 { | |
502 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
503 "duplicate upstream \"%V\"", &u->host); | |
504 return NULL; | |
505 } | |
506 | |
507 if ((uscfp[i]->flags & NGX_STREAM_UPSTREAM_CREATE) && !u->no_port) { | |
508 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
509 "upstream \"%V\" may not have port %d", | |
510 &u->host, u->port); | |
511 return NULL; | |
512 } | |
513 | |
514 if ((flags & NGX_STREAM_UPSTREAM_CREATE) && !uscfp[i]->no_port) { | |
515 ngx_log_error(NGX_LOG_WARN, cf->log, 0, | |
516 "upstream \"%V\" may not have port %d in %s:%ui", | |
517 &u->host, uscfp[i]->port, | |
518 uscfp[i]->file_name, uscfp[i]->line); | |
519 return NULL; | |
520 } | |
521 | |
522 if (uscfp[i]->port != u->port) { | |
523 continue; | |
524 } | |
525 | |
526 if (flags & NGX_STREAM_UPSTREAM_CREATE) { | |
527 uscfp[i]->flags = flags; | |
528 } | |
529 | |
530 return uscfp[i]; | |
531 } | |
532 | |
533 uscf = ngx_pcalloc(cf->pool, sizeof(ngx_stream_upstream_srv_conf_t)); | |
534 if (uscf == NULL) { | |
535 return NULL; | |
536 } | |
537 | |
538 uscf->flags = flags; | |
539 uscf->host = u->host; | |
540 uscf->file_name = cf->conf_file->file.name.data; | |
541 uscf->line = cf->conf_file->line; | |
542 uscf->port = u->port; | |
543 uscf->no_port = u->no_port; | |
544 | |
6459
78fc2dce69e7
Stream: detect port absence in proxy_pass with IP literal.
Roman Arutyunyan <arut@nginx.com>
parents:
6379
diff
changeset
|
545 if (u->naddrs == 1 && (u->port || u->family == AF_UNIX)) { |
6115 | 546 uscf->servers = ngx_array_create(cf->pool, 1, |
547 sizeof(ngx_stream_upstream_server_t)); | |
548 if (uscf->servers == NULL) { | |
549 return NULL; | |
550 } | |
551 | |
552 us = ngx_array_push(uscf->servers); | |
553 if (us == NULL) { | |
554 return NULL; | |
555 } | |
556 | |
557 ngx_memzero(us, sizeof(ngx_stream_upstream_server_t)); | |
558 | |
559 us->addrs = u->addrs; | |
560 us->naddrs = 1; | |
561 } | |
562 | |
563 uscfp = ngx_array_push(&umcf->upstreams); | |
564 if (uscfp == NULL) { | |
565 return NULL; | |
566 } | |
567 | |
568 *uscfp = uscf; | |
569 | |
570 return uscf; | |
571 } | |
572 | |
573 | |
574 static void * | |
575 ngx_stream_upstream_create_main_conf(ngx_conf_t *cf) | |
576 { | |
577 ngx_stream_upstream_main_conf_t *umcf; | |
578 | |
579 umcf = ngx_pcalloc(cf->pool, sizeof(ngx_stream_upstream_main_conf_t)); | |
580 if (umcf == NULL) { | |
581 return NULL; | |
582 } | |
583 | |
584 if (ngx_array_init(&umcf->upstreams, cf->pool, 4, | |
585 sizeof(ngx_stream_upstream_srv_conf_t *)) | |
586 != NGX_OK) | |
587 { | |
588 return NULL; | |
589 } | |
590 | |
591 return umcf; | |
592 } | |
593 | |
594 | |
595 static char * | |
596 ngx_stream_upstream_init_main_conf(ngx_conf_t *cf, void *conf) | |
597 { | |
598 ngx_stream_upstream_main_conf_t *umcf = conf; | |
599 | |
600 ngx_uint_t i; | |
601 ngx_stream_upstream_init_pt init; | |
602 ngx_stream_upstream_srv_conf_t **uscfp; | |
603 | |
604 uscfp = umcf->upstreams.elts; | |
605 | |
606 for (i = 0; i < umcf->upstreams.nelts; i++) { | |
607 | |
608 init = uscfp[i]->peer.init_upstream | |
609 ? uscfp[i]->peer.init_upstream | |
610 : ngx_stream_upstream_init_round_robin; | |
611 | |
612 if (init(cf, uscfp[i]) != NGX_OK) { | |
613 return NGX_CONF_ERROR; | |
614 } | |
615 } | |
616 | |
617 return NGX_CONF_OK; | |
618 } |