Klaus Demo nginx / 0eee3b0
Core: handling of getsockopt(TCP_DEFER_ACCEPT) failures. Recent Linux versions started to return EOPNOTSUPP to getsockopt() calls on unix sockets, resulting in log pollution on binary upgrade. Such errors are silently ignored now. Maxim Dounin 8 years ago
3 changed file(s) with 12 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
9292 ngx_uint_t i;
9393 ngx_listening_t *ls;
9494 socklen_t olen;
95 #if (NGX_HAVE_DEFERRED_ACCEPT)
96 ngx_err_t err;
97 #endif
9598 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
96 ngx_err_t err;
9799 struct accept_filter_arg af;
98100 #endif
99101 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
247249 if (getsockopt(ls[i].fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &timeout, &olen)
248250 == -1)
249251 {
250 ngx_log_error(NGX_LOG_NOTICE, cycle->log, ngx_errno,
252 err = ngx_errno;
253
254 if (err == NGX_EOPNOTSUPP) {
255 continue;
256 }
257
258 ngx_log_error(NGX_LOG_NOTICE, cycle->log, err,
251259 "getsockopt(TCP_DEFER_ACCEPT) for %V failed, ignored",
252260 &ls[i].addr_text);
253261 continue;
3333 #define NGX_ENOSPC ENOSPC
3434 #define NGX_EPIPE EPIPE
3535 #define NGX_EINPROGRESS EINPROGRESS
36 #define NGX_EOPNOTSUPP EOPNOTSUPP
3637 #define NGX_EADDRINUSE EADDRINUSE
3738 #define NGX_ECONNABORTED ECONNABORTED
3839 #define NGX_ECONNRESET ECONNRESET
3737 #define NGX_EPIPE EPIPE
3838 #define NGX_EAGAIN WSAEWOULDBLOCK
3939 #define NGX_EINPROGRESS WSAEINPROGRESS
40 #define NGX_EOPNOTSUPP WSAEOPNOTSUPP
4041 #define NGX_EADDRINUSE WSAEADDRINUSE
4142 #define NGX_ECONNABORTED WSAECONNABORTED
4243 #define NGX_ECONNRESET WSAECONNRESET