mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-13 23:14:46 +00:00
[CLEANUP] frontend: only apply TCP-specific settings to TCP/TCP6 sockets
It's useless to apply keep-alive or lingering to non-TCP sockets.
This commit is contained in:
parent
0499e3575c
commit
9c3bc229ec
@ -88,15 +88,19 @@ int frontend_accept(struct session *s)
|
||||
s->srv_error = default_srv_error;
|
||||
|
||||
/* Adjust some socket options */
|
||||
if ((s->listener->addr.ss_family != AF_UNIX) &&
|
||||
setsockopt(cfd, IPPROTO_TCP, TCP_NODELAY, (char *) &one, sizeof(one)) == -1)
|
||||
goto out_return;
|
||||
if (s->listener->addr.ss_family == AF_INET || s->listener->addr.ss_family == AF_INET6) {
|
||||
if (setsockopt(cfd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(char *) &one, sizeof(one)) == -1)
|
||||
goto out_return;
|
||||
|
||||
if (s->fe->options & PR_O_TCP_CLI_KA)
|
||||
setsockopt(cfd, SOL_SOCKET, SO_KEEPALIVE, (char *) &one, sizeof(one));
|
||||
if (s->fe->options & PR_O_TCP_CLI_KA)
|
||||
setsockopt(cfd, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(char *) &one, sizeof(one));
|
||||
|
||||
if (s->fe->options & PR_O_TCP_NOLING)
|
||||
setsockopt(cfd, SOL_SOCKET, SO_LINGER, (struct linger *) &nolinger, sizeof(struct linger));
|
||||
if (s->fe->options & PR_O_TCP_NOLING)
|
||||
setsockopt(cfd, SOL_SOCKET, SO_LINGER,
|
||||
(struct linger *) &nolinger, sizeof(struct linger));
|
||||
}
|
||||
|
||||
if (global.tune.client_sndbuf)
|
||||
setsockopt(cfd, SOL_SOCKET, SO_SNDBUF, &global.tune.client_sndbuf, sizeof(global.tune.client_sndbuf));
|
||||
|
Loading…
Reference in New Issue
Block a user