mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-05 21:11:53 +00:00
MEDIUM: connection: make conn_sock_shutw() aware of lingering
Instead of having to manually handle lingering outside, let's make conn_sock_shutw() check for it before calling shutdown(). We simply don't want to emit the FIN if we're going to reset the connection due to lingering. It's particularly important for silent-drop where it's absolutely mandatory that no packet leaves the machine.
This commit is contained in:
parent
1a0545f3d7
commit
f9ce57e86c
@ -432,7 +432,8 @@ static inline void conn_sock_shutw(struct connection *c)
|
|||||||
{
|
{
|
||||||
c->flags |= CO_FL_SOCK_WR_SH;
|
c->flags |= CO_FL_SOCK_WR_SH;
|
||||||
__conn_sock_stop_send(c);
|
__conn_sock_stop_send(c);
|
||||||
if (conn_ctrl_ready(c))
|
/* don't perform a clean shutdown if we're going to reset */
|
||||||
|
if (conn_ctrl_ready(c) && !fdtab[c->handle.fd].linger_risk)
|
||||||
shutdown(c->handle.fd, SHUT_WR);
|
shutdown(c->handle.fd, SHUT_WR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,6 +861,7 @@ static void stream_int_shutw_conn(struct stream_interface *si)
|
|||||||
else {
|
else {
|
||||||
/* clean data-layer shutdown */
|
/* clean data-layer shutdown */
|
||||||
conn_xprt_shutw(conn);
|
conn_xprt_shutw(conn);
|
||||||
|
conn_sock_shutw(conn);
|
||||||
|
|
||||||
/* If the stream interface is configured to disable half-open
|
/* If the stream interface is configured to disable half-open
|
||||||
* connections, we'll skip the shutdown(), but only if the
|
* connections, we'll skip the shutdown(), but only if the
|
||||||
@ -869,9 +870,6 @@ static void stream_int_shutw_conn(struct stream_interface *si)
|
|||||||
* waiting for the server).
|
* waiting for the server).
|
||||||
*/
|
*/
|
||||||
if (!(si->flags & SI_FL_NOHALF) || !(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
|
if (!(si->flags & SI_FL_NOHALF) || !(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
|
||||||
/* We shutdown transport layer */
|
|
||||||
conn_sock_shutw(conn);
|
|
||||||
|
|
||||||
if (!(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
|
if (!(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
|
||||||
/* OK just a shutw, but we want the caller
|
/* OK just a shutw, but we want the caller
|
||||||
* to disable polling on this FD if exists.
|
* to disable polling on this FD if exists.
|
||||||
|
Loading…
Reference in New Issue
Block a user