]> git.kaiwu.me - nginx.git/commit
Fixed TCP_DEFER_ACCEPT handling (ticket #353).
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 28 Jan 2014 11:40:46 +0000 (15:40 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 28 Jan 2014 11:40:46 +0000 (15:40 +0400)
commit4cdd17f6bff9b27b3b51a8b5f9d4798985485271
treebccbeb1d7c7ed1659567700595684cc43ef9d64f
parent612f981744dd4eaa9c25542d5485844e5109ce7f
Fixed TCP_DEFER_ACCEPT handling (ticket #353).

Backed out 05a56ebb084a, as it turns out that kernel can return connections
without any delay if syncookies are used.  This basically means we can't
assume anything about connections returned with deferred accept set.

To solve original problem the 05a56ebb084a tried to solve, i.e. to don't
wait longer than needed if a connection was accepted after deferred accept
timeout, this patch changes a timeout set with setsockopt(TCP_DEFER_ACCEPT)
to 1 second, unconditionally.  This is believed to be enough for speed
improvements, and doesn't imply major changes to timeouts used.

Note that before 2.6.32 connections were dropped after a timeout.  Though
it is believed that 1s is still appropriate for kernels before 2.6.32,
as previously tcp_synack_retries controlled the actual timeout and 1s results
in more than 1 minute actual timeout by default.
src/core/ngx_connection.c
src/http/ngx_http_request.c