From d0d40ebf5e71e527c09826b5a9d49ba8462c1b52 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 9 Nov 2018 14:56:01 +0100 Subject: [PATCH] CLEANUP: stream-int: remove the now unused si->update() function 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 | 22 ---------------- include/types/stream_interface.h | 3 +-- src/stream_interface.c | 43 +++----------------------------- 3 files changed, 4 insertions(+), 64 deletions(-) diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index c8d0a4c34..7fc6d7e21 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -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. diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h index 0362afdf5..4d71c875a 100644 --- a/include/types/stream_interface.h +++ b/include/types/stream_interface.h @@ -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 */ diff --git a/src/stream_interface.c b/src/stream_interface.c index 4788a20ab..29a76e44f 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -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)); }