]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stream-int: remove the now unused si->update() function
authorWilly Tarreau <w@1wt.eu>
Fri, 9 Nov 2018 13:56:01 +0000 (14:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2018 09:18:37 +0000 (10:18 +0100)
We exclusively use stream_int_update() now, the lower layers are not
called anymore so let's remove them, as well as si_update() which used
to be their wrapper.

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

index c8d0a4c3430aa2f1d6819a30960996ab05b2244f..7fc6d7e21d125b63239b2d70d0952900164b3ffb 100644 (file)
@@ -50,8 +50,6 @@ extern struct data_cb si_idle_conn_cb;
 struct appctx *stream_int_register_handler(struct stream_interface *si, struct applet *app);
 void si_applet_wake_cb(struct stream_interface *si);
 void stream_int_update(struct stream_interface *si);
-void stream_int_update_conn(struct stream_interface *si);
-void stream_int_update_applet(struct stream_interface *si);
 void stream_int_notify(struct stream_interface *si);
 int si_cs_recv(struct conn_stream *cs);
 int si_cs_send(struct conn_stream *cs);
@@ -364,26 +362,6 @@ static inline void si_shutw(struct stream_interface *si)
        si->ops->shutw(si);
 }
 
-/* Updates the stream interface and timers, to complete the work after the
- * analysers, then clears the relevant channel flags, and the errors and
- * expirations, then updates the data layer below. This will ensure that any
- * synchronous update performed at the data layer will be reflected in the
- * channel flags and/or stream-interface.
- */
-static inline void si_update(struct stream_interface *si)
-{
-       if (si->state == SI_ST_EST)
-               stream_int_update(si);
-
-       si_ic(si)->flags &= ~(CF_READ_NULL|CF_READ_PARTIAL|CF_READ_ATTACHED);
-       si_oc(si)->flags &= ~(CF_WRITE_NULL|CF_WRITE_PARTIAL);
-       si->flags &= ~(SI_FL_ERR|SI_FL_EXP);
-       si->prev_state = si->state;
-
-       if (si->ops->update && (si->state == SI_ST_CON || si->state == SI_ST_EST))
-               si->ops->update(si);
-}
-
 /* This is to be used after making some room available in a channel. It will
  * return without doing anything if {SI_FL_WANT_PUT,SI_FL_WAIT_ROOM} != {1,0}.
  * It will then call ->chk_rcv() to enable receipt of new data.
index 0362afdf58ab3d5e436ed5addbc3b47506ac1232..4d71c875a38770da9bc6a903015bc5afedc611a0 100644 (file)
@@ -86,7 +86,7 @@ enum {
 
 /* Note that if an applet is registered, the update function will not be called
  * by the session handler, so it may be used to resync flags at the end of the
- * applet handler. See stream_int_update_embedded() for reference.
+ * applet handler. See stream_int_update() for reference.
  */
 struct stream_interface {
        /* struct members used by the "buffer" side */
@@ -106,7 +106,6 @@ struct stream_interface {
 
 /* operations available on a stream-interface */
 struct si_ops {
-       void (*update)(struct stream_interface *);  /* I/O update function, may be null */
        void (*chk_rcv)(struct stream_interface *); /* chk_rcv function, may not be null */
        void (*chk_snd)(struct stream_interface *); /* chk_snd function, may not be null */
        void (*shutr)(struct stream_interface *);   /* shut read function, may not be null */
index 4788a20ab9dbc19ed4cd9eba67cad0f0e8acc8af..29a76e44f50c9b92ce84200d791c96a96ca7122f 100644 (file)
@@ -66,7 +66,6 @@ struct si_ops si_embedded_ops = {
 
 /* stream-interface operations for connections */
 struct si_ops si_conn_ops = {
-       .update  = stream_int_update_conn,
        .chk_rcv = stream_int_chk_rcv_conn,
        .chk_snd = stream_int_chk_snd_conn,
        .shutr   = stream_int_shutr_conn,
@@ -75,7 +74,6 @@ struct si_ops si_conn_ops = {
 
 /* stream-interface operations for connections */
 struct si_ops si_applet_ops = {
-       .update  = stream_int_update_applet,
        .chk_rcv = stream_int_chk_rcv_applet,
        .chk_snd = stream_int_chk_snd_applet,
        .shutr   = stream_int_shutr_applet,
@@ -884,30 +882,6 @@ void si_update_both(struct stream_interface *si_f, struct stream_interface *si_b
                appctx_wakeup(si_appctx(si_b));
 }
 
-/* Updates the active status of a connection outside of the connection handler
- * based on the channel's flags and the stream interface's flags. It needs to
- * be called once after the channels' flags have settled down and the stream
- * has been updated. It is not designed to be called from within the connection
- * handler itself.
- */
-void stream_int_update_conn(struct stream_interface *si)
-{
-       struct channel *ic = si_ic(si);
-       struct channel *oc = si_oc(si);
-       struct conn_stream *cs = __objt_cs(si->end);
-
-       if (!(ic->flags & CF_SHUTR)) {
-               /* Read not closed, it doesn't seem we have to do anything here */
-       }
-
-       if (!(oc->flags & CF_SHUTW) && /* Write not closed */
-           !channel_is_empty(oc) &&
-           !(cs->flags & CS_FL_ERROR) &&
-           !(cs->conn->flags & CO_FL_ERROR)) {
-               si_cs_process(cs);
-       }
-}
-
 /*
  * This function performs a shutdown-read on a stream interface attached to
  * a connection in a connected or init state (it does nothing for other
@@ -1457,20 +1431,9 @@ void si_applet_wake_cb(struct stream_interface *si)
         * to wakeup the appctx but in the case the task is not in runqueue
         * we may have to wakeup the appctx immediately.
         */
-       if (!task_in_rq(si_task(si)))
-               stream_int_update_applet(si);
-}
-
-/* Updates the activity status of an applet outside of the applet handler based
- * on the channel's flags and the stream interface's flags. It needs to be
- * called once after the channels' flags have settled down and the stream has
- * been updated. It is not designed to be called from within the applet handler
- * itself.
- */
-void stream_int_update_applet(struct stream_interface *si)
-{
-       if (((si->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) == SI_FL_WANT_PUT) ||
-           ((si->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET))
+       if (!task_in_rq(si_task(si)) &&
+           (((si->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) == SI_FL_WANT_PUT) ||
+            ((si->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET)))
                appctx_wakeup(si_appctx(si));
 }