From: Willy Tarreau Date: Thu, 12 Mar 2015 22:04:07 +0000 (+0100) Subject: MEDIUM: stream-int: replace xprt->shutw calls with conn_data_shutw() X-Git-Tag: v1.6-dev2~339 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1398aa19d8d8035aef662749b55780a5cd4490b4;p=thirdparty%2Fhaproxy.git MEDIUM: stream-int: replace xprt->shutw calls with conn_data_shutw() Now that the connection performs the correct controls when shutting down, use that in the few places where conn->xprt->shutw() was called. The calls were split between conn_data_shutw() and conn_data_shutw_hard() depending on the argument. Since the connection flags are updated, we don't need to call conn_data_stop_send() anymore, instead we just have to call conn_cond_update_polling(). --- diff --git a/src/stream_interface.c b/src/stream_interface.c index f2a5332c4d..d237a826db 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -854,12 +854,7 @@ static void stream_int_shutr_conn(struct stream_interface *si) * states). It either shuts the write side or marks itself as closed. The * buffer flags are updated to reflect the new state. It does also close * everything if the SI was marked as being in error state. If there is a - * data-layer shutdown, it is called. If a control layer is defined, then it is - * supposed to be a socket layer and file descriptors are then shutdown or - * closed accordingly. The function automatically disables polling if needed. - * Note: at the moment, we continue to check conn->ctrl eventhough we *know* it - * is valid. This will help selecting the proper shutdown() and setsockopt() - * calls if/when we implement remote sockets later. + * data-layer shutdown, it is called. */ static void stream_int_shutw_conn(struct stream_interface *si) { @@ -887,13 +882,11 @@ static void stream_int_shutw_conn(struct stream_interface *si) } else if (si->flags & SI_FL_NOLINGER) { /* unclean data-layer shutdown */ - if (conn->xprt && conn->xprt->shutw) - conn->xprt->shutw(conn, 0); + conn_data_shutw_hard(conn); } else { /* clean data-layer shutdown */ - if (conn->xprt && conn->xprt->shutw) - conn->xprt->shutw(conn, 1); + conn_data_shutw(conn); /* If the stream interface is configured to disable half-open * connections, we'll skip the shutdown(), but only if the @@ -909,8 +902,7 @@ static void stream_int_shutw_conn(struct stream_interface *si) /* OK just a shutw, but we want the caller * to disable polling on this FD if exists. */ - if (conn->ctrl) - conn_data_stop_send(conn); + conn_cond_update_polling(conn); return; } } @@ -1366,8 +1358,7 @@ void stream_sock_read0(struct stream_interface *si) if (si->flags & SI_FL_NOHALF) { /* we want to immediately forward this close to the write side */ /* force flag on ssl to keep session in cache */ - if (conn->xprt->shutw) - conn->xprt->shutw(conn, 0); + conn_data_shutw_hard(conn); goto do_close; }