Mercurial > hg > nginx
comparison src/core/ngx_cycle.c @ 6462:fd4b52e74f96
Fixed socket inheritance on reload and binary upgrade.
On nginx reload or binary upgrade, an attempt is made to inherit listen sockets
from the previous configuration. Previously, no check for socket type was made
and the inherited socket could have the wrong type. On binary upgrade, socket
type was not detected at all. Wrong socket type could lead to errors on that
socket due to different logic and unsupported syscalls. For example, a UDP
socket, inherited as TCP, lead to the following error after arrival of a
datagram: "accept() failed (102: Operation not supported on socket)".
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 25 Mar 2016 14:10:38 +0300 |
parents | 85dea406e18f |
children | f01ab2dbcfdc |
comparison
equal
deleted
inserted
replaced
6461:a01e315b3a78 | 6462:fd4b52e74f96 |
---|---|
510 | 510 |
511 if (ls[i].remain) { | 511 if (ls[i].remain) { |
512 continue; | 512 continue; |
513 } | 513 } |
514 | 514 |
515 if (ls[i].type != nls[n].type) { | |
516 continue; | |
517 } | |
518 | |
515 if (ngx_cmp_sockaddr(nls[n].sockaddr, nls[n].socklen, | 519 if (ngx_cmp_sockaddr(nls[n].sockaddr, nls[n].socklen, |
516 ls[i].sockaddr, ls[i].socklen, 1) | 520 ls[i].sockaddr, ls[i].socklen, 1) |
517 == NGX_OK) | 521 == NGX_OK) |
518 { | 522 { |
519 nls[n].fd = ls[i].fd; | 523 nls[n].fd = ls[i].fd; |