]> 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)
commitc94c24b1773e39e610ad81e46872fc2a58c7a88d
treec1c8868a0905ac84345df4470df6abafcf568bd1
parent1631393f9427892f108d2c6549a568ee1e5ed6bc
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