comparison src/core/ngx_connection.c @ 306:55328d69b335 NGINX_0_5_23

nginx 0.5.23 *) Feature: the ngx_http_ssl_module supports Server Name Indication TLS extension. *) Feature: the "fastcgi_catch_stderr" directive. Thanks to Nick S. Grechukh, OWOX project. *) Bugfix: a segmentation fault occurred in master process if two virtual servers should bind() to the overlapping ports. *) Bugfix: if nginx was built with ngx_http_perl_module and perl supported threads, then during second reconfiguration the error messages "panic: MUTEX_LOCK" and "perl_parse() failed" were issued. *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Jun 2007 00:00:00 +0400
parents 71ff1e2b484a
children 9fc4ab6673f9
comparison
equal deleted inserted replaced
305:892db29abb4f 306:55328d69b335
268 { 268 {
269 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, 269 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
270 "setsockopt(SO_REUSEADDR) %V failed", 270 "setsockopt(SO_REUSEADDR) %V failed",
271 &ls[i].addr_text); 271 &ls[i].addr_text);
272 272
273 if (ngx_close_socket(s) == -1) 273 if (ngx_close_socket(s) == -1) {
274 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, 274 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
275 ngx_close_socket_n " %V failed", 275 ngx_close_socket_n " %V failed",
276 &ls[i].addr_text); 276 &ls[i].addr_text);
277 }
277 278
278 return NGX_ERROR; 279 return NGX_ERROR;
279 } 280 }
280 281
281 /* TODO: close on exit */ 282 /* TODO: close on exit */
284 if (ngx_nonblocking(s) == -1) { 285 if (ngx_nonblocking(s) == -1) {
285 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, 286 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
286 ngx_nonblocking_n " %V failed", 287 ngx_nonblocking_n " %V failed",
287 &ls[i].addr_text); 288 &ls[i].addr_text);
288 289
289 if (ngx_close_socket(s) == -1) 290 if (ngx_close_socket(s) == -1) {
290 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, 291 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
291 ngx_close_socket_n " %V failed", 292 ngx_close_socket_n " %V failed",
292 &ls[i].addr_text); 293 &ls[i].addr_text);
294 }
293 295
294 return NGX_ERROR; 296 return NGX_ERROR;
295 } 297 }
296 } 298 }
297 299
306 } 308 }
307 309
308 ngx_log_error(NGX_LOG_EMERG, log, err, 310 ngx_log_error(NGX_LOG_EMERG, log, err,
309 "bind() to %V failed", &ls[i].addr_text); 311 "bind() to %V failed", &ls[i].addr_text);
310 312
311 if (ngx_close_socket(s) == -1) 313 if (ngx_close_socket(s) == -1) {
312 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, 314 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
313 ngx_close_socket_n " %V failed", 315 ngx_close_socket_n " %V failed",
314 &ls[i].addr_text); 316 &ls[i].addr_text);
317 }
315 318
316 if (err != NGX_EADDRINUSE) { 319 if (err != NGX_EADDRINUSE) {
317 return NGX_ERROR; 320 return NGX_ERROR;
318 } 321 }
319 322
320 failed = 1; 323 failed = 1;
321 324
322 continue; 325 continue;
326 }
327
328 if (listen(s, ls[i].backlog) == -1) {
329 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
330 "listen() to %V, backlog %d failed",
331 &ls[i].addr_text, ls[i].backlog);
332
333 if (ngx_close_socket(s) == -1) {
334 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
335 ngx_close_socket_n " %V failed",
336 &ls[i].addr_text);
337 }
338
339 return NGX_ERROR;
323 } 340 }
324 341
325 ls[i].listen = 1; 342 ls[i].listen = 1;
326 343
327 ls[i].fd = s; 344 ls[i].fd = s;
400 } 417 }
401 } 418 }
402 #endif 419 #endif
403 420
404 if (ls[i].listen) { 421 if (ls[i].listen) {
422
423 /* change backlog via listen() */
424
405 if (listen(ls[i].fd, ls[i].backlog) == -1) { 425 if (listen(ls[i].fd, ls[i].backlog) == -1) {
406 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno, 426 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
407 "changing the listen() backlog to %d " 427 "listen() to %V, backlog %d failed, ignored",
408 "for %V failed, ignored",
409 &ls[i].addr_text, ls[i].backlog); 428 &ls[i].addr_text, ls[i].backlog);
410 } 429 }
411 } 430 }
412 431
413 /* 432 /*