1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2025-04-07 01:31:35 +00:00

MEDIUM: connection: replace conn_full_close() with cs_close()

At all call places where a conn_stream is in use, we can now use
cs_close() to get rid of a conn_stream and of its underlying connection
if the mux estimates it makes sense. This is what is currently being
done for the pass-through mux.
This commit is contained in:
Willy Tarreau 2017-10-05 18:52:17 +02:00
parent 4b79524591
commit a553ae96f5
3 changed files with 15 additions and 30 deletions

View File

@ -1400,7 +1400,7 @@ static int wake_srv_chk(struct conn_stream *cs)
* sure want to abort the hard way.
*/
conn_sock_drain(conn);
conn_full_close(conn);
cs_close(cs);
ret = -1;
}
@ -2207,7 +2207,7 @@ static struct task *process_chk_conn(struct task *t)
* server state to be suddenly changed.
*/
conn_sock_drain(conn);
conn_full_close(conn);
cs_close(cs);
}
if (conn) {
@ -2686,9 +2686,8 @@ static int tcpcheck_main(struct check *check)
* 3: release and replace the old one on success
*/
if (check->cs) {
/* XXX: need to kill all CS here as well but not to free them yet */
conn_full_close(check->cs->conn);
retcode = -1; /* do not reuse the fd! */
cs_close(check->cs);
retcode = -1; /* do not reuse the fd in the caller! */
}
/* mark the step as started */

View File

@ -579,7 +579,7 @@ static int sess_update_st_con_tcp(struct stream *s)
struct stream_interface *si = &s->si[1];
struct channel *req = &s->req;
struct channel *rep = &s->res;
struct connection *srv_conn = __objt_cs(si->end)->conn;
struct conn_stream *srv_cs = __objt_cs(si->end);
/* If we got an error, or if nothing happened and the connection timed
* out, we must give up. The CER state handler will take care of retry
@ -602,7 +602,7 @@ static int sess_update_st_con_tcp(struct stream *s)
/* XXX cognet: do we really want to kill the connection here ?
* Probably not for multiple streams.
*/
conn_full_close(srv_conn);
cs_close(srv_cs);
if (si->err_type)
return 0;

View File

@ -821,8 +821,7 @@ static void stream_int_shutr_conn(struct stream_interface *si)
return;
if (si_oc(si)->flags & CF_SHUTW) {
/* XXX: should just close cs ? */
conn_full_close(conn);
cs_close(cs);
si->state = SI_ST_DIS;
si->exp = TICK_ETERNITY;
}
@ -890,22 +889,13 @@ static void stream_int_shutw_conn(struct stream_interface *si)
* layer to try to signal it to the peer before we close.
*/
cs_shutw(cs, CS_SHW_NORMAL);
conn_sock_shutw(conn);
/* If the stream interface is configured to disable half-open
* connections, we'll skip the shutdown(), but only if the
* read size is already closed. Otherwise we can't support
* closed write with pending read (eg: abortonclose while
* waiting for the server).
*/
if (!(si->flags & SI_FL_NOHALF) || !(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
if (!(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
/* OK just a shutw, but we want the caller
* to disable polling on this FD if exists.
*/
conn_cond_update_polling(conn);
return;
}
if (!(ic->flags & (CF_SHUTR|CF_DONT_READ))) {
/* OK just a shutw, but we want the caller
* to disable polling on this FD if exists.
*/
conn_cond_update_polling(conn);
return;
}
}
@ -914,7 +904,7 @@ static void stream_int_shutw_conn(struct stream_interface *si)
/* we may have to close a pending connection, and mark the
* response buffer as shutr
*/
conn_full_close(conn);
cs_close(cs);
/* fall through */
case SI_ST_CER:
case SI_ST_QUE:
@ -1369,11 +1359,7 @@ void stream_sock_read0(struct stream_interface *si)
do_close:
/* OK we completely close the socket here just as if we went through si_shut[rw]() */
conn_full_close(cs->conn);
ic->flags &= ~CF_SHUTR_NOW;
ic->flags |= CF_SHUTR;
ic->rex = TICK_ETERNITY;
cs_close(cs);
oc->flags &= ~CF_SHUTW_NOW;
oc->flags |= CF_SHUTW;