Mercurial > hg > nginx-quic
comparison src/os/unix/ngx_darwin_init.c @ 4226:003f0f341edf
Fixed range checking for the "somaxconn" sysctl.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Tue, 25 Oct 2011 13:48:05 +0000 |
parents | 1b779cb69dc8 |
children | d620f497c50f |
comparison
equal
deleted
inserted
replaced
4225:016352c19049 | 4226:003f0f341edf |
---|---|
86 | 86 |
87 | 87 |
88 ngx_int_t | 88 ngx_int_t |
89 ngx_os_specific_init(ngx_log_t *log) | 89 ngx_os_specific_init(ngx_log_t *log) |
90 { | 90 { |
91 int somaxconn; | |
92 size_t size; | 91 size_t size; |
93 ngx_err_t err; | 92 ngx_err_t err; |
94 ngx_uint_t i; | 93 ngx_uint_t i; |
95 | 94 |
96 size = sizeof(ngx_darwin_kern_ostype); | 95 size = sizeof(ngx_darwin_kern_ostype); |
153 return NGX_ERROR; | 152 return NGX_ERROR; |
154 } | 153 } |
155 | 154 |
156 ngx_ncpu = ngx_darwin_hw_ncpu; | 155 ngx_ncpu = ngx_darwin_hw_ncpu; |
157 | 156 |
158 somaxconn = 32676; | 157 if (ngx_darwin_kern_ipc_somaxconn > 32767) { |
159 | |
160 if (ngx_darwin_kern_ipc_somaxconn > somaxconn) { | |
161 ngx_log_error(NGX_LOG_ALERT, log, 0, | 158 ngx_log_error(NGX_LOG_ALERT, log, 0, |
162 "sysctl kern.ipc.somaxconn must be no more than %d", | 159 "sysctl kern.ipc.somaxconn must be less than 32768"); |
163 somaxconn); | |
164 return NGX_ERROR; | 160 return NGX_ERROR; |
165 } | 161 } |
166 | 162 |
167 ngx_tcp_nodelay_and_tcp_nopush = 1; | 163 ngx_tcp_nodelay_and_tcp_nopush = 1; |
168 | 164 |