]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: remove the last calls to conn_xprt_{want,stop}_*
authorWilly Tarreau <w@1wt.eu>
Fri, 21 Feb 2020 09:34:19 +0000 (10:34 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 21 Feb 2020 10:21:12 +0000 (11:21 +0100)
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.

include/proto/connection.h
src/connection.c

index 7fb41af1d51e8e6a40e93b1c91ac9f70ce838f77..e4f4de90c3ddaff69af405b0752d23cb27df6c39 100644 (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)
index 713bc12fa50cee20cbbd74ef4c5d3028e5c29f6e..c58db587493f7ebaa4e1e6c59db791aa4b61153a 100644 (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;
 }