Mercurial > hg > nginx
comparison src/core/ngx_connection.c @ 6872:6ed0922d316b
Added cycle parameter to ngx_drain_connections().
No functional changes, mostly style.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 20 Jan 2017 14:03:19 +0300 |
parents | 631753428ecb |
children | 426828549afc |
comparison
equal
deleted
inserted
replaced
6871:1818acd8442f | 6872:6ed0922d316b |
---|---|
11 | 11 |
12 | 12 |
13 ngx_os_io_t ngx_io; | 13 ngx_os_io_t ngx_io; |
14 | 14 |
15 | 15 |
16 static void ngx_drain_connections(void); | 16 static void ngx_drain_connections(ngx_cycle_t *cycle); |
17 | 17 |
18 | 18 |
19 ngx_listening_t * | 19 ngx_listening_t * |
20 ngx_create_listening(ngx_conf_t *cf, struct sockaddr *sockaddr, | 20 ngx_create_listening(ngx_conf_t *cf, struct sockaddr *sockaddr, |
21 socklen_t socklen) | 21 socklen_t socklen) |
1044 } | 1044 } |
1045 | 1045 |
1046 c = ngx_cycle->free_connections; | 1046 c = ngx_cycle->free_connections; |
1047 | 1047 |
1048 if (c == NULL) { | 1048 if (c == NULL) { |
1049 ngx_drain_connections(); | 1049 ngx_drain_connections((ngx_cycle_t *) ngx_cycle); |
1050 c = ngx_cycle->free_connections; | 1050 c = ngx_cycle->free_connections; |
1051 } | 1051 } |
1052 | 1052 |
1053 if (c == NULL) { | 1053 if (c == NULL) { |
1054 ngx_log_error(NGX_LOG_ALERT, log, 0, | 1054 ngx_log_error(NGX_LOG_ALERT, log, 0, |
1224 } | 1224 } |
1225 } | 1225 } |
1226 | 1226 |
1227 | 1227 |
1228 static void | 1228 static void |
1229 ngx_drain_connections(void) | 1229 ngx_drain_connections(ngx_cycle_t *cycle) |
1230 { | 1230 { |
1231 ngx_int_t i; | 1231 ngx_int_t i; |
1232 ngx_queue_t *q; | 1232 ngx_queue_t *q; |
1233 ngx_connection_t *c; | 1233 ngx_connection_t *c; |
1234 | 1234 |
1235 for (i = 0; i < 32; i++) { | 1235 for (i = 0; i < 32; i++) { |
1236 if (ngx_queue_empty(&ngx_cycle->reusable_connections_queue)) { | 1236 if (ngx_queue_empty(&cycle->reusable_connections_queue)) { |
1237 break; | 1237 break; |
1238 } | 1238 } |
1239 | 1239 |
1240 q = ngx_queue_last(&ngx_cycle->reusable_connections_queue); | 1240 q = ngx_queue_last(&cycle->reusable_connections_queue); |
1241 c = ngx_queue_data(q, ngx_connection_t, queue); | 1241 c = ngx_queue_data(q, ngx_connection_t, queue); |
1242 | 1242 |
1243 ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0, | 1243 ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0, |
1244 "reusing connection"); | 1244 "reusing connection"); |
1245 | 1245 |