]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream-int: temporarily make si_chk_rcv() take care of SI_FL_WAIT_ROOM
authorWilly Tarreau <w@1wt.eu>
Wed, 7 Nov 2018 10:55:54 +0000 (11:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2018 09:18:37 +0000 (10:18 +0100)
This flag should already be cleared before calling the *chk_rcv() functions.
Before adapting all call places, let's first make sure si_chk_rcv() clears
it before calling them so that these functions do not have to check it again
and so that they do not adjust it. This function will only call the lower
layers if the SI_FL_WANT_PUT flag is present so that the endpoint can decide
not to be called (as done with applets).

include/proto/stream_interface.h
src/stream_interface.c

index 7bab7ffd043199d1f8dbf894c21bd65290b0d37f..a687b2ac6cfec4537b82b49329277a59ce8f39e9 100644 (file)
@@ -385,9 +385,17 @@ static inline void si_update(struct stream_interface *si)
                si->ops->update(si);
 }
 
-/* Calls chk_rcv on the connection using the data layer */
+/* This is to be used after making some room available in a channel. It will
+ * clear SI_FL_WAIT_ROOM, then if SI_FL_WANT_PUT is set, will calls ->chk_rcv()
+ * to enable receipt of new data.
+ */
 static inline void si_chk_rcv(struct stream_interface *si)
 {
+       si->flags &= ~SI_FL_WAIT_ROOM;
+
+       if (!(si->flags & SI_FL_WANT_PUT))
+               return;
+
        si->ops->chk_rcv(si);
 }
 
index b0ccf9e97130d9a096f13e87f17abefa7ddb1e94..ad9ff9efdb0cb8ecf4beef01a2903209c17f57be 100644 (file)
@@ -257,7 +257,6 @@ static void stream_int_chk_rcv(struct stream_interface *si)
        }
        else {
                /* (re)start reading */
-               si->flags &= ~SI_FL_WAIT_ROOM;
                tasklet_wakeup(si->wait_event.task);
                if (!(si->flags & SI_FL_DONT_WAKE))
                        task_wakeup(si_task(si), TASK_WOKEN_IO);
@@ -970,7 +969,6 @@ static void stream_int_chk_rcv_conn(struct stream_interface *si)
        }
        else {
                /* (re)start reading */
-               si->flags &= ~SI_FL_WAIT_ROOM;
                tasklet_wakeup(si->wait_event.task);
        }
 }
@@ -1502,9 +1500,6 @@ static void stream_int_chk_rcv_applet(struct stream_interface *si)
 
        if (unlikely(si->state != SI_ST_EST || (ic->flags & (CF_SHUTR|CF_DONT_READ))))
                return;
-       /* here we only wake the applet up if it was waiting for some room */
-       if (!(si->flags & SI_FL_WAIT_ROOM))
-               return;
 
        if (channel_may_recv(ic) && !ic->pipe) {
                /* (re)start reading */