]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: connections: Remove CONN_FL_SOCK*
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 28 May 2019 08:12:02 +0000 (10:12 +0200)
committerOlivier Houchard <cognet@ci0.org>
Wed, 5 Jun 2019 16:03:38 +0000 (18:03 +0200)
Now that the various handshakes come with their own XPRT, there's no
need for the CONN_FL_SOCK* flags, and the conn_sock_want|stop functions,
so garbage-collect them.

include/proto/connection.h
include/types/connection.h
src/connection.c
src/proto_sockpair.c
src/proto_tcp.c
src/proto_uxst.c
src/raw_sock.c
src/ssl_sock.c
src/stream_interface.c

index ac4e5de34f9abe5661b1be1923e08a337869f18b..67177c5627b68033945137b8ee4d1be244edc0b9 100644 (file)
@@ -158,14 +158,6 @@ static inline void conn_stop_tracking(struct connection *conn)
        conn->flags &= ~CO_FL_XPRT_TRACKED;
 }
 
-/* Update polling on connection <c>'s file descriptor depending on its current
- * state as reported in the connection's CO_FL_CURR_* flags, reports of EAGAIN
- * in CO_FL_WAIT_*, and the sock layer expectations indicated by CO_FL_SOCK_*.
- * The connection flags are updated with the new flags at the end of the
- * operation. Polling is totally disabled if an error was reported.
- */
-void conn_update_sock_polling(struct connection *c);
-
 /* Update polling on connection <c>'s file descriptor depending on its current
  * state as reported in the connection's CO_FL_CURR_* flags, reports of EAGAIN
  * in CO_FL_WAIT_*, and the upper layer expectations indicated by CO_FL_XPRT_*.
@@ -216,51 +208,17 @@ static inline unsigned int conn_xprt_polling_changes(const struct connection *c)
        return f & (CO_FL_CURR_WR_ENA | CO_FL_CURR_RD_ENA | CO_FL_ERROR);
 }
 
-/* inspects c->flags and returns non-zero if SOCK ENA changes from the CURR ENA
- * or if the WAIT flags are set with their respective ENA flags. Additionally,
- * non-zero is also returned if an error was reported on the connection. This
- * function is used quite often and is inlined. In order to proceed optimally
- * with very little code and CPU cycles, the bits are arranged so that a change
- * can be detected by a few left shifts, a xor, and a mask. These operations
- * detect when W&S are both enabled for either direction, when C&S differ for
- * either direction and when Error is set. The trick consists in first keeping
- * only the bits we're interested in, since they don't collide when shifted,
- * and to perform the AND at the end. In practice, the compiler is able to
- * replace the last AND with a TEST in boolean conditions. This results in
- * checks that are done in 4-6 cycles and less than 30 bytes.
- */
-static inline unsigned int conn_sock_polling_changes(const struct connection *c)
-{
-       unsigned int f = c->flags;
-       f &= CO_FL_SOCK_WR_ENA | CO_FL_SOCK_RD_ENA | CO_FL_CURR_WR_ENA |
-            CO_FL_CURR_RD_ENA | CO_FL_ERROR;
-
-       f = (f ^ (f << 2)) & (CO_FL_CURR_WR_ENA|CO_FL_CURR_RD_ENA);    /* test C ^ S */
-       return f & (CO_FL_CURR_WR_ENA | CO_FL_CURR_RD_ENA | CO_FL_ERROR);
-}
-
-/* Automatically updates polling on connection <c> depending on the XPRT flags
- * if no handshake is in progress. It does nothing if CO_FL_WILL_UPDATE is
- * present, indicating that an upper caller is going to do it again later.
+/* Automatically updates polling on connection <c> depending on the XPRT flags.
+ * It does nothing if CO_FL_WILL_UPDATE is present, indicating that an upper
+ * caller is going to do it again later.
  */
 static inline void conn_cond_update_xprt_polling(struct connection *c)
 {
        if (!(c->flags & CO_FL_WILL_UPDATE))
-               if (!(c->flags & CO_FL_POLL_SOCK) && conn_xprt_polling_changes(c))
+               if (conn_xprt_polling_changes(c))
                        conn_update_xprt_polling(c);
 }
 
-/* Automatically updates polling on connection <c> depending on the SOCK flags
- * if a handshake is in progress. It does nothing if CO_FL_WILL_UPDATE is
- * present, indicating that an upper caller is going to do it again later.
- */
-static inline void conn_cond_update_sock_polling(struct connection *c)
-{
-       if (!(c->flags & CO_FL_WILL_UPDATE))
-               if ((c->flags & CO_FL_POLL_SOCK) && conn_sock_polling_changes(c))
-                       conn_update_sock_polling(c);
-}
-
 /* Stop all polling on the fd. This might be used when an error is encountered
  * for example. It does not propage the change to the fd layer if
  * CO_FL_WILL_UPDATE is present, indicating that an upper caller is going to do
@@ -269,7 +227,6 @@ static inline void conn_cond_update_sock_polling(struct connection *c)
 static inline void conn_stop_polling(struct connection *c)
 {
        c->flags &= ~(CO_FL_CURR_RD_ENA | CO_FL_CURR_WR_ENA |
-                     CO_FL_SOCK_RD_ENA | CO_FL_SOCK_WR_ENA |
                      CO_FL_XPRT_RD_ENA | CO_FL_XPRT_WR_ENA);
        if (!(c->flags & CO_FL_WILL_UPDATE) && conn_ctrl_ready(c))
                fd_stop_both(c->handle.fd);
@@ -287,10 +244,8 @@ static inline void conn_cond_update_polling(struct connection *c)
        if (unlikely(c->flags & CO_FL_ERROR))
                conn_stop_polling(c);
        else if (!(c->flags & CO_FL_WILL_UPDATE)) {
-               if (!(c->flags & CO_FL_POLL_SOCK) && conn_xprt_polling_changes(c))
+               if (conn_xprt_polling_changes(c))
                        conn_update_xprt_polling(c);
-               else if ((c->flags & CO_FL_POLL_SOCK) && conn_sock_polling_changes(c))
-                       conn_update_sock_polling(c);
        }
 }
 
@@ -368,73 +323,13 @@ static inline void conn_xprt_stop_both(struct connection *c)
        conn_cond_update_xprt_polling(c);
 }
 
-/***** Event manipulation primitives for use by handshake I/O callbacks *****/
-/* The __conn_* versions do not propagate to lower layers and are only meant
- * to be used by handlers called by the connection handler. The other ones
- * may be used anywhere.
- */
-static inline void __conn_sock_want_recv(struct connection *c)
-{
-       c->flags |= CO_FL_SOCK_RD_ENA;
-}
-
-static inline void __conn_sock_stop_recv(struct connection *c)
-{
-       c->flags &= ~CO_FL_SOCK_RD_ENA;
-}
-
-static inline void __conn_sock_want_send(struct connection *c)
-{
-       c->flags |= CO_FL_SOCK_WR_ENA;
-}
-
-static inline void __conn_sock_stop_send(struct connection *c)
-{
-       c->flags &= ~CO_FL_SOCK_WR_ENA;
-}
-
-static inline void __conn_sock_stop_both(struct connection *c)
-{
-       c->flags &= ~(CO_FL_SOCK_WR_ENA | CO_FL_SOCK_RD_ENA);
-}
-
-static inline void conn_sock_want_recv(struct connection *c)
-{
-       __conn_sock_want_recv(c);
-       conn_cond_update_sock_polling(c);
-}
-
-static inline void conn_sock_stop_recv(struct connection *c)
-{
-       __conn_sock_stop_recv(c);
-       conn_cond_update_sock_polling(c);
-}
-
-static inline void conn_sock_want_send(struct connection *c)
-{
-       __conn_sock_want_send(c);
-       conn_cond_update_sock_polling(c);
-}
-
-static inline void conn_sock_stop_send(struct connection *c)
-{
-       __conn_sock_stop_send(c);
-       conn_cond_update_sock_polling(c);
-}
-
-static inline void conn_sock_stop_both(struct connection *c)
-{
-       __conn_sock_stop_both(c);
-       conn_cond_update_sock_polling(c);
-}
-
 /* read shutdown, called from the rcv_buf/rcv_pipe handlers when
  * detecting an end of connection.
  */
 static inline void conn_sock_read0(struct connection *c)
 {
        c->flags |= CO_FL_SOCK_RD_SH;
-       __conn_sock_stop_recv(c);
+       __conn_xprt_stop_recv(c);
        /* we don't risk keeping ports unusable if we found the
         * zero from the other side.
         */
@@ -451,8 +346,8 @@ static inline void conn_sock_shutw(struct connection *c, int clean)
 {
        c->flags |= CO_FL_SOCK_WR_SH;
        conn_refresh_polling_flags(c);
-       __conn_sock_stop_send(c);
-       conn_cond_update_sock_polling(c);
+       __conn_xprt_stop_send(c);
+       conn_cond_update_xprt_polling(c);
 
        /* don't perform a clean shutdown if we're going to reset or
         * if the shutr was already received.
index e706b87a04a4daded265111a9f289749fe95d8c5..54f8d1a3391f4961ff5d4257769d9450a51edd7b 100644 (file)
@@ -136,12 +136,12 @@ enum {
        CO_FL_NONE          = 0x00000000,  /* Just for initialization purposes */
 
        /* Do not change these values without updating conn_*_poll_changes() ! */
-       CO_FL_SOCK_RD_ENA   = 0x00000001,  /* receiving handshakes is allowed */
+       /* unusued : 0x00000001 */
        CO_FL_XPRT_RD_ENA   = 0x00000002,  /* receiving data is allowed */
        CO_FL_CURR_RD_ENA   = 0x00000004,  /* receiving is currently allowed */
        /* unused : 0x00000008 */
 
-       CO_FL_SOCK_WR_ENA   = 0x00000010,  /* sending handshakes is desired */
+       /* unused : 0x00000010 */
        CO_FL_XPRT_WR_ENA   = 0x00000020,  /* sending data is desired */
        CO_FL_CURR_WR_ENA   = 0x00000040,  /* sending is currently desired */
        /* unused : 0x00000080 */
@@ -194,13 +194,6 @@ enum {
        CO_FL_HANDSHAKE     = CO_FL_SEND_PROXY | CO_FL_SSL_WAIT_HS | CO_FL_ACCEPT_PROXY | CO_FL_ACCEPT_CIP | CO_FL_SOCKS4_SEND | CO_FL_SOCKS4_RECV,
        CO_FL_HANDSHAKE_NOSSL = CO_FL_SEND_PROXY | CO_FL_ACCEPT_PROXY | CO_FL_ACCEPT_CIP | CO_FL_SOCKS4_SEND | CO_FL_SOCKS4_RECV,
 
-       /* when any of these flags is set, polling is defined by socket-layer
-        * operations, as opposed to data-layer. Transport is explicitly not
-        * mentionned here to avoid any confusion, since it can be the same
-        * as DATA or SOCK on some implementations.
-        */
-       CO_FL_POLL_SOCK     = CO_FL_HANDSHAKE | CO_FL_WAIT_L4_CONN | CO_FL_WAIT_L6_CONN,
-
        /* This connection may not be shared between clients */
        CO_FL_PRIVATE       = 0x10000000,
 
index 838d8fda1cb8ff5781b3dae7457d01ef3063a2a2..380d58c5b5e3b4bd927b1241c5262f741fd06903 100644 (file)
@@ -58,15 +58,6 @@ void conn_fd_handler(int fd)
 
        flags = conn->flags & ~CO_FL_ERROR; /* ensure to call the wake handler upon error */
 
-       if (conn->flags & CO_FL_HANDSHAKE) {
-               if (!conn->send_wait)
-                       __conn_sock_stop_send(conn);
-               if (!conn->recv_wait)
-                       __conn_sock_stop_recv(conn);
-       }
-       if (!(conn->flags & CO_FL_POLL_SOCK))
-               __conn_sock_stop_both(conn);
-
        /* The connection owner might want to be notified about an end of
         * handshake indicating the connection is ready, before we proceed with
         * any data exchange. The callback may fail and cause the connection to
@@ -197,41 +188,6 @@ void conn_update_xprt_polling(struct connection *c)
        c->flags = f;
 }
 
-/* Update polling on connection <c>'s file descriptor depending on its current
- * state as reported in the connection's CO_FL_CURR_* flags, reports of EAGAIN
- * in CO_FL_WAIT_*, and the sock layer expectations indicated by CO_FL_SOCK_*.
- * The connection flags are updated with the new flags at the end of the
- * operation. Polling is totally disabled if an error was reported.
- */
-void conn_update_sock_polling(struct connection *c)
-{
-       unsigned int f = c->flags;
-
-       if (!conn_ctrl_ready(c))
-               return;
-
-       /* update read status if needed */
-       if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_SOCK_RD_ENA)) == CO_FL_SOCK_RD_ENA)) {
-               fd_want_recv(c->handle.fd);
-               f |= CO_FL_CURR_RD_ENA;
-       }
-       else if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_SOCK_RD_ENA)) == CO_FL_CURR_RD_ENA)) {
-               fd_stop_recv(c->handle.fd);
-               f &= ~CO_FL_CURR_RD_ENA;
-       }
-
-       /* update write status if needed */
-       if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_SOCK_WR_ENA)) == CO_FL_SOCK_WR_ENA)) {
-               fd_want_send(c->handle.fd);
-               f |= CO_FL_CURR_WR_ENA;
-       }
-       else if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_SOCK_WR_ENA)) == CO_FL_CURR_WR_ENA)) {
-               fd_stop_send(c->handle.fd);
-               f &= ~CO_FL_CURR_WR_ENA;
-       }
-       c->flags = f;
-}
-
 /* Send a message over an established connection. It makes use of send() and
  * returns the same return code and errno. If the socket layer is not ready yet
  * then -1 is returned and ENOTSOCK is set into errno. If the fd is not marked
@@ -704,12 +660,9 @@ int conn_recv_proxy(struct connection *conn, int flag)
 
        conn->flags &= ~flag;
        conn->flags |= CO_FL_RCVD_PROXY;
-       __conn_sock_stop_recv(conn);
        return 1;
 
  not_ready:
-       __conn_sock_want_recv(conn);
-       __conn_sock_stop_send(conn);
        return 0;
 
  missing:
@@ -731,7 +684,6 @@ int conn_recv_proxy(struct connection *conn, int flag)
        goto fail;
 
  fail:
-       __conn_sock_stop_both(conn);
        conn->flags |= CO_FL_ERROR;
        return 0;
 }
@@ -908,12 +860,9 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
        } while (0);
 
        conn->flags &= ~flag;
-       __conn_sock_stop_recv(conn);
        return 1;
 
  not_ready:
-       __conn_sock_want_recv(conn);
-       __conn_sock_stop_send(conn);
        return 0;
 
  missing:
@@ -934,7 +883,6 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
        goto fail;
 
  fail:
-       __conn_sock_stop_both(conn);
        conn->flags |= CO_FL_ERROR;
        return 0;
 }
@@ -991,7 +939,6 @@ int conn_send_socks4_proxy_request(struct connection *conn)
 
        /* OK we've the whole request sent */
        conn->flags &= ~CO_FL_SOCKS4_SEND;
-       __conn_sock_stop_send(conn);
 
        /* The connection is ready now, simply return and let the connection
         * handler notify upper layers if needed.
@@ -1018,8 +965,6 @@ int conn_send_socks4_proxy_request(struct connection *conn)
        return 0;
 
  out_wait:
-       __conn_sock_stop_recv(conn);
-       __conn_sock_want_send(conn);
        return 0;
 }
 
@@ -1125,12 +1070,9 @@ int conn_recv_socks4_proxy_response(struct connection *conn)
        } while (0);
 
        conn->flags &= ~CO_FL_SOCKS4_RECV;
-       __conn_sock_stop_recv(conn);
        return 1;
 
  not_ready:
-       __conn_sock_want_recv(conn);
-       __conn_sock_stop_send(conn);
        return 0;
 
  recv_abort:
@@ -1141,7 +1083,6 @@ int conn_recv_socks4_proxy_response(struct connection *conn)
        goto fail;
 
  fail:
-       __conn_sock_stop_both(conn);
        conn->flags |= CO_FL_ERROR;
        return 0;
 }
index 97a93480af6488d2595f7422c4c2d56c622d2604..a4faa370a623e76e141eb14b91cad381696631d0 100644 (file)
@@ -327,20 +327,7 @@ static int sockpair_connect_server(struct connection *conn, int flags)
                return SF_ERR_RESOURCE;
        }
 
-       if (conn->flags & (CO_FL_HANDSHAKE | CO_FL_WAIT_L4_CONN)) {
-               conn_sock_want_send(conn);  /* for connect status, proxy protocol or SSL */
-       }
-       else {
-               /* If there's no more handshake, we need to notify the data
-                * layer when the connection is already OK otherwise we'll have
-                * no other opportunity to do it later (eg: health checks).
-                */
-               flags |= CONNECT_HAS_DATA;
-       }
-
-       if (flags & CONNECT_HAS_DATA)
-               conn_xprt_want_send(conn);  /* prepare to send data if any */
-
+       conn_xprt_want_send(conn);  /* for connect status, proxy protocol or SSL */
        return SF_ERR_NONE;  /* connection is OK */
 }
 
index 7ae28f085e055f596ad4d32fae3319f6e6e329e2..c64e48cd5cfb47254142b20748302e0264d73bb1 100644 (file)
@@ -578,22 +578,7 @@ int tcp_connect_server(struct connection *conn, int flags)
                return SF_ERR_RESOURCE;
        }
 
-       if (conn->flags & (CO_FL_HANDSHAKE | CO_FL_WAIT_L4_CONN | CO_FL_EARLY_SSL_HS)) {
-               conn_sock_want_send(conn);  /* for connect status, proxy protocol or SSL */
-               if (conn->flags & CO_FL_EARLY_SSL_HS)
-                       conn_xprt_want_send(conn);
-       }
-       else {
-               /* If there's no more handshake, we need to notify the data
-                * layer when the connection is already OK otherwise we'll have
-                * no other opportunity to do it later (eg: health checks).
-                */
-               flags |= CONNECT_HAS_DATA;
-       }
-
-       if (flags & CONNECT_HAS_DATA)
-               conn_xprt_want_send(conn);  /* prepare to send data if any */
-
+       conn_xprt_want_send(conn);  /* for connect status, proxy protocol or SSL */
        return SF_ERR_NONE;  /* connection is OK */
 }
 
@@ -706,7 +691,7 @@ int tcp_connect_probe(struct connection *conn)
 
        if (connect(fd, (const struct sockaddr *)addr, get_addr_len(addr)) == -1) {
                if (errno == EALREADY || errno == EINPROGRESS) {
-                       __conn_sock_stop_recv(conn);
+                       __conn_xprt_stop_recv(conn);
                        fd_cant_send(fd);
                        return 0;
                }
@@ -730,7 +715,7 @@ int tcp_connect_probe(struct connection *conn)
         */
        fdtab[fd].linger_risk = 0;
        conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
-       __conn_sock_stop_both(conn);
+       __conn_xprt_stop_both(conn);
        return 0;
 }
 
index 42e0dc878f8d303b0bb75b019615e16592c71bbf..66093af65a6cf4cfb86db2f24ea0f0d755dff7fc 100644 (file)
@@ -578,20 +578,7 @@ static int uxst_connect_server(struct connection *conn, int flags)
                return SF_ERR_RESOURCE;
        }
 
-       if (conn->flags & (CO_FL_HANDSHAKE | CO_FL_WAIT_L4_CONN)) {
-               conn_sock_want_send(conn);  /* for connect status, proxy protocol or SSL */
-       }
-       else {
-               /* If there's no more handshake, we need to notify the data
-                * layer when the connection is already OK otherwise we'll have
-                * no other opportunity to do it later (eg: health checks).
-                */
-               flags |= CONNECT_HAS_DATA;
-       }
-
-       if (flags & CONNECT_HAS_DATA)
-               conn_xprt_want_send(conn);  /* prepare to send data if any */
-
+       conn_xprt_want_send(conn);  /* for connect status, proxy protocol or SSL */
        return SF_ERR_NONE;  /* connection is OK */
 }
 
index ad9f79257b3100e43d77ebb90a6e1bb7fc30c1c3..cc9966925b29e424dc6ad528b32a427dc7df3034 100644 (file)
@@ -157,7 +157,6 @@ int raw_sock_to_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe,
                conn->flags &= ~CO_FL_WAIT_L4_CONN;
 
  leave:
-       conn_cond_update_sock_polling(conn);
        if (retval > 0) {
                /* we count the total bytes sent, and the send rate for 32-byte
                 * blocks. The reason for the latter is that freq_ctr are
@@ -211,7 +210,6 @@ int raw_sock_from_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pip
        if (unlikely(conn->flags & CO_FL_WAIT_L4_CONN) && done)
                conn->flags &= ~CO_FL_WAIT_L4_CONN;
 
-       conn_cond_update_sock_polling(conn);
        return done;
 }
 
@@ -310,7 +308,6 @@ static size_t raw_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
                conn->flags &= ~CO_FL_WAIT_L4_CONN;
 
  leave:
-       conn_cond_update_sock_polling(conn);
        return done;
 
  read0:
@@ -393,7 +390,6 @@ static size_t raw_sock_from_buf(struct connection *conn, void *xprt_ctx, const s
        if (unlikely(conn->flags & CO_FL_WAIT_L4_CONN) && done)
                conn->flags &= ~CO_FL_WAIT_L4_CONN;
 
-       conn_cond_update_sock_polling(conn);
        if (done > 0) {
                /* we count the total bytes sent, and the send rate for 32-byte
                 * blocks. The reason for the latter is that freq_ctr are
index fed53d5b0610c3b0a7a6b72be4beefad2a592a26..6829823b4524ba7784005742b5abb198a5d4011b 100644 (file)
@@ -542,7 +542,6 @@ fail_get:
 void ssl_async_fd_handler(int fd)
 {
        struct ssl_sock_ctx *ctx = fdtab[fd].owner;
-       struct connection *conn = ctx->conn;
 
        /* fd is an async enfine fd, we must stop
         * to poll this fd until it is requested
@@ -553,9 +552,7 @@ void ssl_async_fd_handler(int fd)
        /* crypto engine is available, let's notify the associated
         * connection that it can pursue its processing.
         */
-       __conn_sock_want_recv(conn);
-       __conn_sock_want_send(conn);
-       conn_update_sock_polling(conn);
+       ssl_sock_io_cb(NULL, ctx, 0);
 }
 
 /*
@@ -597,7 +594,6 @@ static inline void ssl_async_process_fds(struct ssl_sock_ctx *ctx)
        OSSL_ASYNC_FD add_fd[32];
        OSSL_ASYNC_FD del_fd[32];
        SSL *ssl = ctx->ssl;
-       struct connection *conn = ctx->conn;
        size_t num_add_fds = 0;
        size_t num_del_fds = 0;
        int i;
@@ -640,11 +636,6 @@ static inline void ssl_async_process_fds(struct ssl_sock_ctx *ctx)
                fd_cant_recv(add_fd[i]);
        }
 
-       /* We must also prevent the conn_handler
-        * to be called until a read event was
-        * polled on an async fd
-        */
-       __conn_sock_stop_both(conn);
 }
 #endif
 
@@ -5331,10 +5322,8 @@ static int ssl_sock_handshake(struct connection *conn, unsigned int flag)
 
                        if (ret == SSL_ERROR_WANT_WRITE) {
                                /* SSL handshake needs to write, L4 connection may not be ready */
-                               if (!(ctx->wait_event.events & SUB_RETRY_SEND)) {
-                                               __conn_sock_want_send(conn);
+                               if (!(ctx->wait_event.events & SUB_RETRY_SEND))
                                        ctx->xprt->subscribe(conn, ctx->xprt_ctx, SUB_RETRY_SEND, &ctx->wait_event);
-                               }
                                return 0;
                        }
                        else if (ret == SSL_ERROR_WANT_READ) {
@@ -5346,10 +5335,8 @@ static int ssl_sock_handshake(struct connection *conn, unsigned int flag)
                                        goto reneg_ok;
                                }
                                /* SSL handshake needs to read, L4 connection is ready */
-                               if (!(ctx->wait_event.events & SUB_RETRY_RECV)) {
-                                               __conn_sock_want_recv(conn);
+                               if (!(ctx->wait_event.events & SUB_RETRY_RECV))
                                        ctx->xprt->subscribe(conn, ctx->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event);
-                               }
                                return 0;
                        }
 #if (HA_OPENSSL_VERSION_NUMBER >= 0x1010000fL) && !defined(OPENSSL_NO_ASYNC)
@@ -5422,20 +5409,15 @@ check_error:
 
                if (ret == SSL_ERROR_WANT_WRITE) {
                        /* SSL handshake needs to write, L4 connection may not be ready */
-                       if (!(ctx->wait_event.events & SUB_RETRY_SEND)) {
-                               __conn_sock_want_send(conn);
+                       if (!(ctx->wait_event.events & SUB_RETRY_SEND))
                                ctx->xprt->subscribe(conn, ctx->xprt_ctx, SUB_RETRY_SEND, &ctx->wait_event);
-                       }
                        return 0;
                }
                else if (ret == SSL_ERROR_WANT_READ) {
                        /* SSL handshake needs to read, L4 connection is ready */
                        if (!(ctx->wait_event.events & SUB_RETRY_RECV))
-                       {
-                               __conn_sock_want_recv(conn);
                                ctx->xprt->subscribe(conn, ctx->xprt_ctx,
                                    SUB_RETRY_RECV, &ctx->wait_event);
-                       }
                        return 0;
                }
 #if (HA_OPENSSL_VERSION_NUMBER >= 0x1010000fL) && !defined(OPENSSL_NO_ASYNC)
@@ -5809,7 +5791,6 @@ static size_t ssl_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
                        if (ret == SSL_ERROR_WANT_WRITE) {
                                /* handshake is running, and it needs to enable write */
                                conn->flags |= CO_FL_SSL_WAIT_HS;
-                               __conn_sock_want_send(conn);
                                ctx->xprt->subscribe(conn, ctx->xprt_ctx, SUB_RETRY_SEND, &ctx->wait_event);
 #if (HA_OPENSSL_VERSION_NUMBER >= 0x1010000fL) && !defined(OPENSSL_NO_ASYNC)
                                /* Async mode can be re-enabled, because we're leaving data state.*/
@@ -5825,7 +5806,6 @@ static size_t ssl_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
                                                             &ctx->wait_event);
                                        /* handshake is running, and it may need to re-enable read */
                                        conn->flags |= CO_FL_SSL_WAIT_HS;
-                                       __conn_sock_want_recv(conn);
 #if (HA_OPENSSL_VERSION_NUMBER >= 0x1010000fL) && !defined(OPENSSL_NO_ASYNC)
                                        /* Async mode can be re-enabled, because we're leaving data state.*/
                                        if (global_ssl.async)
@@ -5848,7 +5828,6 @@ static size_t ssl_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
                        break;
        }
  leave:
-       conn_cond_update_sock_polling(conn);
        return done;
 
  clear_ssl_error:
@@ -5973,7 +5952,6 @@ static size_t ssl_sock_from_buf(struct connection *conn, void *xprt_ctx, const s
                                if (SSL_renegotiate_pending(ctx->ssl)) {
                                        /* handshake is running, and it may need to re-enable write */
                                        conn->flags |= CO_FL_SSL_WAIT_HS;
-                                       __conn_sock_want_send(conn);
                                        ctx->xprt->subscribe(conn, ctx->xprt_ctx, SUB_RETRY_SEND, &ctx->wait_event);
 #if (HA_OPENSSL_VERSION_NUMBER >= 0x1010000fL) && !defined(OPENSSL_NO_ASYNC)
                                        /* Async mode can be re-enabled, because we're leaving data state.*/
@@ -5988,7 +5966,6 @@ static size_t ssl_sock_from_buf(struct connection *conn, void *xprt_ctx, const s
                        else if (ret == SSL_ERROR_WANT_READ) {
                                /* handshake is running, and it needs to enable read */
                                conn->flags |= CO_FL_SSL_WAIT_HS;
-                               __conn_sock_want_recv(conn);
                                ctx->xprt->subscribe(conn, ctx->xprt_ctx,
                                                     SUB_RETRY_RECV,
                                                     &ctx->wait_event);
@@ -6003,7 +5980,6 @@ static size_t ssl_sock_from_buf(struct connection *conn, void *xprt_ctx, const s
                }
        }
  leave:
-       conn_cond_update_sock_polling(conn);
        return done;
 
  out_error:
index a6d5d020ada918bee8abee70dce74f0c12ea1304..bdc9b0079d918dfd918e5067123e09cbb1b4e504 100644 (file)
@@ -422,7 +422,6 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
        if (conn->flags & CO_FL_WAIT_L4_CONN)
                conn->flags &= ~CO_FL_WAIT_L4_CONN;
        conn->flags &= ~flag;
-       __conn_sock_stop_send(conn);
        return 1;
 
  out_error:
@@ -431,8 +430,6 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
        return 0;
 
  out_wait:
-       __conn_sock_stop_recv(conn);
-       __conn_sock_want_send(conn);
        return 0;
 }