mirror of
https://github.com/nginx/nginx.git
synced 2025-06-16 16:51:05 +08:00
ignore EINVAL from setsockopt() on Solaris
This commit is contained in:
parent
d9307664db
commit
0bd7b00eb7
@ -782,12 +782,16 @@ ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text)
|
|||||||
{
|
{
|
||||||
ngx_uint_t level;
|
ngx_uint_t level;
|
||||||
|
|
||||||
if (err == NGX_ECONNRESET
|
if (err == NGX_ECONNRESET && c->log_error == NGX_ERROR_IGNORE_ECONNRESET) {
|
||||||
&& c->log_error == NGX_ERROR_IGNORE_ECONNRESET)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (NGX_SOLARIS)
|
||||||
|
if (err == NGX_EINVAL && c->log_error == NGX_ERROR_IGNORE_EINVAL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (err == 0
|
if (err == 0
|
||||||
|| err == NGX_ECONNRESET
|
|| err == NGX_ECONNRESET
|
||||||
#if !(NGX_WIN32)
|
#if !(NGX_WIN32)
|
||||||
@ -803,6 +807,7 @@ ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text)
|
|||||||
{
|
{
|
||||||
switch (c->log_error) {
|
switch (c->log_error) {
|
||||||
|
|
||||||
|
case NGX_ERROR_IGNORE_EINVAL:
|
||||||
case NGX_ERROR_IGNORE_ECONNRESET:
|
case NGX_ERROR_IGNORE_ECONNRESET:
|
||||||
case NGX_ERROR_INFO:
|
case NGX_ERROR_INFO:
|
||||||
level = NGX_LOG_INFO;
|
level = NGX_LOG_INFO;
|
||||||
|
@ -69,10 +69,11 @@ struct ngx_listening_s {
|
|||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NGX_ERROR_CRIT = 0,
|
NGX_ERROR_ALERT = 0,
|
||||||
NGX_ERROR_ERR,
|
NGX_ERROR_ERR,
|
||||||
NGX_ERROR_INFO,
|
NGX_ERROR_INFO,
|
||||||
NGX_ERROR_IGNORE_ECONNRESET
|
NGX_ERROR_IGNORE_ECONNRESET,
|
||||||
|
NGX_ERROR_IGNORE_EINVAL
|
||||||
} ngx_connection_log_error_e;
|
} ngx_connection_log_error_e;
|
||||||
|
|
||||||
|
|
||||||
@ -131,7 +132,7 @@ struct ngx_connection_s {
|
|||||||
|
|
||||||
unsigned buffered:8;
|
unsigned buffered:8;
|
||||||
|
|
||||||
unsigned log_error:2; /* ngx_connection_log_error_e */
|
unsigned log_error:3; /* ngx_connection_log_error_e */
|
||||||
|
|
||||||
unsigned single_connection:1;
|
unsigned single_connection:1;
|
||||||
unsigned unexpected_eof:1;
|
unsigned unexpected_eof:1;
|
||||||
|
@ -2421,8 +2421,15 @@ ngx_http_set_keepalive(ngx_http_request_t *r)
|
|||||||
(const void *) &tcp_nodelay, sizeof(int))
|
(const void *) &tcp_nodelay, sizeof(int))
|
||||||
== -1)
|
== -1)
|
||||||
{
|
{
|
||||||
|
#if (NGX_SOLARIS)
|
||||||
|
/* Solaris returns EINVAL if a socket has been shut down */
|
||||||
|
c->log_error = NGX_ERROR_IGNORE_EINVAL;
|
||||||
|
#endif
|
||||||
|
|
||||||
ngx_connection_error(c, ngx_socket_errno,
|
ngx_connection_error(c, ngx_socket_errno,
|
||||||
"setsockopt(TCP_NODELAY) failed");
|
"setsockopt(TCP_NODELAY) failed");
|
||||||
|
|
||||||
|
c->log_error = NGX_ERROR_INFO;
|
||||||
ngx_http_close_connection(c);
|
ngx_http_close_connection(c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user