Project

General

Profile

Actions

Feature #1447

closed

TCP_DEFER_ACCEPT

Added by admin about 17 years ago. Updated over 15 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

Hi,

On Linux, TCP_DEFER_ACCEPT can be enabled to defer accept calls until there is (also) data ready to be read.
On FreeBSD, SO_ACCEPTFILTER can be enabled to defer accept calls until there is a complete HTTP request (or something else) to be read.


#ifdef SO_ACCEPTFILTER
    accept_filter_arg afa;
    bzero(&afa, sizeof(afa));
    strcpy(afa.af_name, "httpready");
    l.setsockopt(SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
#elif TCP_DEFER_ACCEPT
    int v = true;
    setsockopt(acceptor_.native(), IPPROTO_TCP, TCP_DEFER_ACCEPT, &v, sizeof(v));
#endif
Actions #1

Updated by Olaf-van-der-Spek almost 16 years ago

  • Target version changed from 1.5.0 to 1.4.21
Actions #2

Updated by icy almost 16 years ago

  • Target version changed from 1.4.21 to 1.4.22
  • Patch available set to No
Actions #3

Updated by stbuehler over 15 years ago

  • Target version changed from 1.4.22 to 1.4.23
Actions #4

Updated by stbuehler over 15 years ago

TCP_DEFER_ACCEPT:

Allows a listener to be awakened only when data arrives on the socket. Takes an integer value (seconds), this can bound the maximum number of attempts TCP will make to complete the connection.

I don't think "TRUE" is a good value here.

Actions #5

Updated by Olaf-van-der-Spek over 15 years ago

You're right, haven't seen that part before. I'm still not sure what exactly that parameter does though.

Actions #6

Updated by stbuehler over 15 years ago

linux kernel sources (net/ipv4/tcp.c), search for TCP_DEFER_ACCEPT:

Translate value in seconds to number of retransmits

I have no idea what that means... :)

0 means disable, so i will make the option a "unsigned short" in the config, and it will be only set if it is != 0.

SO_ACCEPTFILTER is already in the source and enabled by default.

Actions #7

Updated by stbuehler over 15 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2479.

Actions

Also available in: Atom