MINOR: listener: move TCP_FO to bind_conf
It's set per bind line ("tfo") and only used in tcp_bind_listener() so there's no point keeping the address family tests, let's just store the flag in the bind_conf under the name BC_O_TCP_FO.
This commit is contained in:
parent
d9b4d21248
commit
c492f1b17f
|
@ -101,7 +101,7 @@ enum li_status {
|
|||
/* unused 0x0040 */
|
||||
#define LI_O_ACC_PROXY 0x0080 /* find the proxied address in the first request line */
|
||||
#define LI_O_UNLIMITED 0x0100 /* listener not subject to global limits (peers & stats socket) */
|
||||
#define LI_O_TCP_FO 0x0200 /* enable TCP Fast Open (linux >= 3.7) */
|
||||
/* unused 0x0200 */
|
||||
/* unused 0x0400 */
|
||||
/* unused 0x0800 */
|
||||
#define LI_O_ACC_CIP 0x1000 /* find the proxied address in the NetScaler Client IP header */
|
||||
|
@ -124,6 +124,7 @@ enum li_status {
|
|||
#define BC_O_NOLINGER 0x00000080 /* disable lingering on these listeners */
|
||||
#define BC_O_NOQUICKACK 0x00000100 /* disable quick ack of immediate data (linux) */
|
||||
#define BC_O_DEF_ACCEPT 0x00000200 /* wait up to 1 second for data before accepting */
|
||||
#define BC_O_TCP_FO 0x00000400 /* enable TCP Fast Open (linux >= 3.7) */
|
||||
|
||||
|
||||
/* flags used with bind_conf->ssl_options */
|
||||
|
|
|
@ -73,13 +73,7 @@ static int bind_parse_defer_accept(char **args, int cur_arg, struct proxy *px, s
|
|||
/* parse the "tfo" bind keyword */
|
||||
static int bind_parse_tfo(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
|
||||
{
|
||||
struct listener *l;
|
||||
|
||||
list_for_each_entry(l, &conf->listeners, by_bind) {
|
||||
if (l->rx.addr.ss_family == AF_INET || l->rx.addr.ss_family == AF_INET6)
|
||||
l->options |= LI_O_TCP_FO;
|
||||
}
|
||||
|
||||
conf->options |= BC_O_TCP_FO;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -670,7 +670,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
|
|||
sizeof(zero));
|
||||
#endif
|
||||
#if defined(TCP_FASTOPEN)
|
||||
if (listener->options & LI_O_TCP_FO) {
|
||||
if (listener->bind_conf->options & BC_O_TCP_FO) {
|
||||
/* TFO needs a queue length, let's use the configured backlog */
|
||||
int qlen = listener_backlog(listener);
|
||||
if (setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)) == -1) {
|
||||
|
|
Loading…
Reference in New Issue