MINOR: connection: remove the last calls to conn_xprt_{want,stop}_*

The last few calls to conn_xprt_{want,stop}_{recv,send} in the central
connection code were replaced with their strictly exact equivalent fd_*,
adding the call to conn_ctrl_ready() when it was missing.
This commit is contained in:
Willy Tarreau 2020-02-21 10:34:19 +01:00
parent 562e0d8619
commit d1d14c3157
2 changed files with 33 additions and 27 deletions

View File

@ -245,12 +245,13 @@ static inline void conn_xprt_stop_both(struct connection *c)
static inline void conn_sock_read0(struct connection *c)
{
c->flags |= CO_FL_SOCK_RD_SH;
__conn_xprt_stop_recv(c);
/* we don't risk keeping ports unusable if we found the
* zero from the other side.
*/
if (conn_ctrl_ready(c))
if (conn_ctrl_ready(c)) {
fd_stop_recv(c->handle.fd);
/* we don't risk keeping ports unusable if we found the
* zero from the other side.
*/
fdtab[c->handle.fd].linger_risk = 0;
}
}
/* write shutdown, indication that the upper layer is not willing to send
@ -261,18 +262,20 @@ static inline void conn_sock_read0(struct connection *c)
static inline void conn_sock_shutw(struct connection *c, int clean)
{
c->flags |= CO_FL_SOCK_WR_SH;
__conn_xprt_stop_send(c);
/* don't perform a clean shutdown if we're going to reset or
* if the shutr was already received.
*/
if (conn_ctrl_ready(c) && !(c->flags & CO_FL_SOCK_RD_SH) && clean)
shutdown(c->handle.fd, SHUT_WR);
if (conn_ctrl_ready(c)) {
fd_stop_send(c->handle.fd);
/* don't perform a clean shutdown if we're going to reset or
* if the shutr was already received.
*/
if (!(c->flags & CO_FL_SOCK_RD_SH) && clean)
shutdown(c->handle.fd, SHUT_WR);
}
}
static inline void conn_xprt_shutw(struct connection *c)
{
__conn_xprt_stop_send(c);
if (conn_ctrl_ready(c))
fd_stop_send(c->handle.fd);
/* clean data-layer shutdown */
if (c->xprt && c->xprt->shutw)
@ -281,7 +284,8 @@ static inline void conn_xprt_shutw(struct connection *c)
static inline void conn_xprt_shutw_hard(struct connection *c)
{
__conn_xprt_stop_send(c);
if (conn_ctrl_ready(c))
fd_stop_send(c->handle.fd);
/* unclean data-layer shutdown */
if (c->xprt && c->xprt->shutw)

View File

@ -106,7 +106,7 @@ void conn_fd_handler(int fd)
conn->subs = NULL;
} else
io_available = 1;
__conn_xprt_stop_send(conn);
fd_stop_send(fd);
}
/* The data transfer starts here and stops on error and handshakes. Note
@ -126,7 +126,7 @@ void conn_fd_handler(int fd)
conn->subs = NULL;
} else
io_available = 1;
__conn_xprt_stop_recv(conn);
fd_stop_recv(fd);
}
leave:
@ -249,8 +249,8 @@ int conn_fd_check(struct connection *conn)
return 0;
wait:
__conn_xprt_want_send(conn);
fd_cant_send(fd);
fd_want_send(fd);
return 0;
}
@ -324,12 +324,13 @@ int conn_unsubscribe(struct connection *conn, void *xprt_ctx, int event_type, st
if (!es->events)
conn->subs = NULL;
if (event_type & SUB_RETRY_RECV)
__conn_xprt_stop_recv(conn);
if (event_type & SUB_RETRY_SEND)
__conn_xprt_stop_send(conn);
if (conn_ctrl_ready(conn)) {
if (event_type & SUB_RETRY_RECV)
fd_stop_recv(conn->handle.fd);
if (event_type & SUB_RETRY_SEND)
fd_stop_send(conn->handle.fd);
}
return 0;
}
@ -346,12 +347,13 @@ int conn_subscribe(struct connection *conn, void *xprt_ctx, int event_type, stru
conn->subs = es;
es->events |= event_type;
if (event_type & SUB_RETRY_RECV)
__conn_xprt_want_recv(conn);
if (event_type & SUB_RETRY_SEND)
__conn_xprt_want_send(conn);
if (conn_ctrl_ready(conn)) {
if (event_type & SUB_RETRY_RECV)
fd_want_recv(conn->handle.fd);
if (event_type & SUB_RETRY_SEND)
fd_want_send(conn->handle.fd);
}
return 0;
}