]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl_sock: make use of CO_FL_WILL_UPDATE
authorWilly Tarreau <w@1wt.eu>
Wed, 25 Oct 2017 07:32:15 +0000 (09:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 25 Oct 2017 13:52:41 +0000 (15:52 +0200)
Now when ssl_sock_{to,from}_buf are called, if the connection doesn't
feature CO_FL_WILL_UPDATE, they will first retrieve the updated flags
using conn_refresh_polling_flags() before changing any flag, then call
conn_cond_update_sock_polling() before leaving, to commit such changes.

src/ssl_sock.c

index 3afcd52449420d9a020ef39957e7870dde181764..3d9723949b854c999d92881bd14d776dfcf82ed4 100644 (file)
@@ -4851,6 +4851,8 @@ static int ssl_sock_to_buf(struct connection *conn, struct buffer *buf, int coun
        int ret, done = 0;
        int try;
 
+       conn_refresh_polling_flags(conn);
+
        if (!conn->xprt_ctx)
                goto out_error;
 
@@ -4936,18 +4938,20 @@ static int ssl_sock_to_buf(struct connection *conn, struct buffer *buf, int coun
                        goto out_error;
                }
        }
+ leave:
+       conn_cond_update_sock_polling(conn);
        return done;
 
  read0:
        conn_sock_read0(conn);
-       return done;
+       goto leave;
  out_error:
        /* Clear openssl global errors stack */
        ssl_sock_dump_errors(conn);
        ERR_clear_error();
 
        conn->flags |= CO_FL_ERROR;
-       return done;
+       goto leave;
 }
 
 
@@ -4966,6 +4970,7 @@ static int ssl_sock_from_buf(struct connection *conn, struct buffer *buf, int fl
        int ret, try, done;
 
        done = 0;
+       conn_refresh_polling_flags(conn);
 
        if (!conn->xprt_ctx)
                goto out_error;
@@ -5043,6 +5048,8 @@ static int ssl_sock_from_buf(struct connection *conn, struct buffer *buf, int fl
                        goto out_error;
                }
        }
+ leave:
+       conn_cond_update_sock_polling(conn);
        return done;
 
  out_error:
@@ -5051,7 +5058,7 @@ static int ssl_sock_from_buf(struct connection *conn, struct buffer *buf, int fl
        ERR_clear_error();
 
        conn->flags |= CO_FL_ERROR;
-       return done;
+       goto leave;
 }
 
 static void ssl_sock_close(struct connection *conn) {