Hi Willy,

Please check the attachments for the two patches.

Patch 0001: DOC: stick-table can be declared in such sections as
frontend, listen and backend

Patch 0002:  OPTIM: stream_interface: return directly if the connection
flag CO_FL_ERROR has been set

Actually, for patch 0002, the branch out_error in si_conn_send_cb() can
be also deleted since only the following codes use it:

static void si_conn_send_cb(struct connection *conn)
{
        ...
        /* OK there are data waiting to be sent */
        if (si_conn_send_loop(conn) < 0)
                goto out_error;

        /* OK all done */
        return;

 out_error:
        /* Write error on the connection, report the error and stop I/O */
        conn->flags |= CO_FL_ERROR;
}

And si_conn_send_loop() will return -1 when the connection flag has
CO_FL_ERROR set. As a result, we even do not need check the return value
of si_conn_send_loop() since we just want to set CO_FL_ERROR on the
connection flag and there is. The fix should be as below:
 @@ -1138,15 +1138,10 @@ static void si_conn_send_cb(struct connection
*conn)
                 return;

         /* OK there are data waiting to be sent */
 -       if (si_conn_send(conn) < 0)
 -               goto out_error;
 +       si_conn_send(conn);

         /* OK all done */
         return;
 -
 - out_error:
 -       /* Write error on the connection, report the error and stop I/O */
 -       conn->flags |= CO_FL_ERROR;
  }

If you agree with me, I will merge this fix into patch0002 and send the
patch again.

-- 
Best Regards,
Godbach
From 1d9b14eadbfe88f99831e091ee2be6836b44a004 Mon Sep 17 00:00:00 2001
From: Godbach <[email protected]>
Date: Wed, 4 Dec 2013 10:14:50 +0800
Subject: [PATCH 1/2] DOC: stick-table can be declared in such sections as
 frontend, listen and backend

The original manual has only mentioned backend.

Signed-off-by: Godbach <[email protected]>
---
 doc/configuration.txt |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/doc/configuration.txt b/doc/configuration.txt
index 803d42e..38da5bc 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -6133,7 +6133,8 @@ stick store-request <pattern> [table <table>] [{if | 
unless} <condition>]
 stick-table type {ip | integer | string [len <length>] | binary [len <length>]}
             size <size> [expire <expire>] [nopurge] [peers <peersect>]
             [store <data_type>]*
-  Configure the stickiness table for the current backend
+  Configure the stickiness table for the current section including frontend,
+  listen and backend.
   May be used in sections :   defaults | frontend | listen | backend
                                  no    |    yes   |   yes  |   yes
 
-- 
1.7.7

From 2ae8e1c73850addf1aa0ae570eb09a32e6feaa22 Mon Sep 17 00:00:00 2001
From: Godbach <[email protected]>
Date: Wed, 4 Dec 2013 11:10:19 +0800
Subject: [PATCH 2/2] OPTIM: stream_interface: return directly if the
 connection flag CO_FL_ERROR has been set

The connection flag CO_FL_ERROR will be tested in the functions both
si_conn_recv_cb() and si_conn_send_cb(). If CO_FL_ERROR has been set, out_error
branch will be executed. But the only job of out_error branch is to set
CO_FL_ERROR on connection flag. So it's better return directly than goto
out_error branch under such test conditions.

In addition, out_error branch is needless and deleted from si_conn_recv_cb().

Signed-off-by: Godbach <[email protected]>
---
 src/stream_interface.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/stream_interface.c b/src/stream_interface.c
index 9f0c26a..505fa71 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -915,7 +915,7 @@ static void si_conn_recv_cb(struct connection *conn)
         * which rejects it before reading it all.
         */
        if (conn->flags & CO_FL_ERROR)
-               goto out_error;
+               return;
 
        /* stop here if we reached the end of data */
        if (conn_data_read0_pending(conn))
@@ -968,7 +968,7 @@ static void si_conn_recv_cb(struct connection *conn)
                        goto out_shutdown_r;
 
                if (conn->flags & CO_FL_ERROR)
-                       goto out_error;
+                       return;
 
                if (conn->flags & CO_FL_WAIT_ROOM) {
                        /* the pipe is full or we have read enough data that it
@@ -1098,7 +1098,7 @@ static void si_conn_recv_cb(struct connection *conn)
        } /* while !flags */
 
        if (conn->flags & CO_FL_ERROR)
-               goto out_error;
+               return;
 
        if (conn_data_read0_pending(conn))
                /* connection closed */
@@ -1114,10 +1114,6 @@ static void si_conn_recv_cb(struct connection *conn)
        stream_sock_read0(si);
        conn_data_read0(conn);
        return;
-
- out_error:
-       /* Read error on the connection, report the error and stop I/O */
-       conn->flags |= CO_FL_ERROR;
 }
 
 /*
@@ -1131,7 +1127,7 @@ static void si_conn_send_cb(struct connection *conn)
        struct channel *chn = si->ob;
 
        if (conn->flags & CO_FL_ERROR)
-               goto out_error;
+               return;
 
        if (si->conn->flags & CO_FL_HANDSHAKE)
                /* a handshake was requested */
-- 
1.7.7

Reply via email to