mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-24 15:49:14 -04:00
MEDIUM: mux_pt: make cs_shutr() / cs_shutw() properly close the connection
Now these functions are able to automatically close both the transport and the socket layer, causing the whole connection to be torn down if needed. The two shutdown modes are implemented for both directions, and when a direction is closed, if it sees the other one is closed as well, it completes by closing the connection. This is similar to what is performed in the stream interface. It's not deployed yet but the purpose is to get rid of conn_full_close() where only conn_stream should be known.
This commit is contained in:
parent
6978db35e9
commit
4b79524591
1 changed files with 10 additions and 0 deletions
10
src/mux_pt.c
10
src/mux_pt.c
|
|
@ -122,14 +122,24 @@ static void mux_pt_detach(struct conn_stream *cs)
|
|||
|
||||
static void mux_pt_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
|
||||
{
|
||||
if (cs->flags & CS_FL_SHR)
|
||||
return;
|
||||
if (conn_xprt_ready(cs->conn) && cs->conn->xprt->shutr)
|
||||
cs->conn->xprt->shutr(cs->conn, (mode == CS_SHR_DRAIN));
|
||||
if (cs->flags & CS_FL_SHW)
|
||||
conn_full_close(cs->conn);
|
||||
}
|
||||
|
||||
static void mux_pt_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
|
||||
{
|
||||
if (cs->flags & CS_FL_SHW)
|
||||
return;
|
||||
if (conn_xprt_ready(cs->conn) && cs->conn->xprt->shutw)
|
||||
cs->conn->xprt->shutw(cs->conn, (mode == CS_SHW_NORMAL));
|
||||
if (!(cs->flags & CS_FL_SHR))
|
||||
conn_sock_shutw(cs->conn);
|
||||
else
|
||||
conn_full_close(cs->conn);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue