Mercurial > hg > nginx-quic
comparison src/core/ngx_connection.c @ 5550:3c5ddf0575d8
Core: handle getsockopt(TCP_FASTOPEN) failures.
Linux returns EOPNOTSUPP for non-TCP sockets and ENOPROTOOPT for TCP
sockets, because getsockopt(TCP_FASTOPEN) is not implemented so far.
While there, lower the log level from ALERT to NOTICE to match other
getsockopt() failures.
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
author | Piotr Sikora <piotr@cloudflare.com> |
---|---|
date | Thu, 30 Jan 2014 14:58:21 -0800 |
parents | fdb67cfc957d |
children | 188481078faf |
comparison
equal
deleted
inserted
replaced
5549:39d7eef2e332 | 5550:3c5ddf0575d8 |
---|---|
95 { | 95 { |
96 size_t len; | 96 size_t len; |
97 ngx_uint_t i; | 97 ngx_uint_t i; |
98 ngx_listening_t *ls; | 98 ngx_listening_t *ls; |
99 socklen_t olen; | 99 socklen_t olen; |
100 #if (NGX_HAVE_DEFERRED_ACCEPT) | 100 #if (NGX_HAVE_DEFERRED_ACCEPT || NGX_HAVE_TCP_FASTOPEN) |
101 ngx_err_t err; | 101 ngx_err_t err; |
102 #endif | 102 #endif |
103 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) | 103 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) |
104 struct accept_filter_arg af; | 104 struct accept_filter_arg af; |
105 #endif | 105 #endif |
221 | 221 |
222 if (getsockopt(ls[i].fd, IPPROTO_TCP, TCP_FASTOPEN, | 222 if (getsockopt(ls[i].fd, IPPROTO_TCP, TCP_FASTOPEN, |
223 (void *) &ls[i].fastopen, &olen) | 223 (void *) &ls[i].fastopen, &olen) |
224 == -1) | 224 == -1) |
225 { | 225 { |
226 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno, | 226 err = ngx_socket_errno; |
227 "getsockopt(TCP_FASTOPEN) %V failed, ignored", | 227 |
228 &ls[i].addr_text); | 228 if (err != NGX_EOPNOTSUPP && err != NGX_ENOPROTOOPT) { |
229 ngx_log_error(NGX_LOG_NOTICE, cycle->log, err, | |
230 "getsockopt(TCP_FASTOPEN) %V failed, ignored", | |
231 &ls[i].addr_text); | |
232 } | |
229 | 233 |
230 ls[i].fastopen = -1; | 234 ls[i].fastopen = -1; |
231 } | 235 } |
232 | 236 |
233 #endif | 237 #endif |