Mercurial > hg > nginx-quic
comparison src/event/ngx_event.c @ 8515:c860f0b7010c
Core: disabled cloning sockets when testing config (ticket #2188).
Since we anyway do not set SO_REUSEPORT when testing configuration
(see ecb5cd305b06), trying to open additional sockets does not make much
sense, as all these additional sockets are expected to result in EADDRINUSE
errors from bind(). On the other hand, there are reports that trying
to open these sockets takes significant time under load: total configuration
testing time greater than 15s was observed in ticket #2188, compared to less
than 1s without load.
With this change, no additional sockets are opened during testing
configuration.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 31 May 2021 16:36:37 +0300 |
parents | 2ed5d03c2d90 |
children | 6674a50cbb6c e2d07e4ec636 |
comparison
equal
deleted
inserted
replaced
8514:7e4aeb464642 | 8515:c860f0b7010c |
---|---|
439 return NGX_CONF_ERROR; | 439 return NGX_CONF_ERROR; |
440 } | 440 } |
441 | 441 |
442 #if (NGX_HAVE_REUSEPORT) | 442 #if (NGX_HAVE_REUSEPORT) |
443 | 443 |
444 ls = cycle->listening.elts; | 444 if (!ngx_test_config) { |
445 for (i = 0; i < cycle->listening.nelts; i++) { | |
446 | |
447 if (!ls[i].reuseport || ls[i].worker != 0) { | |
448 continue; | |
449 } | |
450 | |
451 if (ngx_clone_listening(cycle, &ls[i]) != NGX_OK) { | |
452 return NGX_CONF_ERROR; | |
453 } | |
454 | |
455 /* cloning may change cycle->listening.elts */ | |
456 | 445 |
457 ls = cycle->listening.elts; | 446 ls = cycle->listening.elts; |
447 for (i = 0; i < cycle->listening.nelts; i++) { | |
448 | |
449 if (!ls[i].reuseport || ls[i].worker != 0) { | |
450 continue; | |
451 } | |
452 | |
453 if (ngx_clone_listening(cycle, &ls[i]) != NGX_OK) { | |
454 return NGX_CONF_ERROR; | |
455 } | |
456 | |
457 /* cloning may change cycle->listening.elts */ | |
458 | |
459 ls = cycle->listening.elts; | |
460 } | |
458 } | 461 } |
459 | 462 |
460 #endif | 463 #endif |
461 | 464 |
462 return NGX_CONF_OK; | 465 return NGX_CONF_OK; |