]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: conn-stream: Remove the stream-interface from the conn-stream
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 4 Apr 2022 09:25:59 +0000 (11:25 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Apr 2022 13:10:16 +0000 (15:10 +0200)
The stream-interface API is no longer used. Thus, it is removed from the
conn-stream. From now, stream-interfaces are now longer used !

include/haproxy/conn_stream-t.h
include/haproxy/conn_stream.h
src/cli.c
src/conn_stream.c
src/debug.c

index eaacaa47e2e1b0b82c7c386c98a94514339c0b55..3981fcb3eb1dffd2a914b875fac1e16bc4c2a3a1 100644 (file)
@@ -26,8 +26,6 @@
 #include <haproxy/obj_type-t.h>
 #include <haproxy/connection-t.h>
 
-struct stream_interface;
-
 /* CS endpoint flags */
  enum {
         CS_EP_NONE       = 0x00000000, /* For initialization purposes */
@@ -175,7 +173,6 @@ struct conn_stream {
        struct wait_event wait_event;        /* We're in a wait list */
        struct cs_endpoint *endp;            /* points to the end point (MUX stream or appctx) */
        enum obj_type *app;                  /* points to the applicative point (stream or check) */
-       struct stream_interface *si;
        const struct data_cb *data_cb;       /* data layer callbacks. Must be set before xprt->init() */
        struct cs_app_ops *ops;              /* general operations used at the app layer */
        struct sockaddr_storage *src;        /* source address (pool), when known, otherwise NULL */
index 9dd064eb9cba94156bff48c01bc18a3b010c73ea..ec88235840488f5cc4dc1e42d87f6a86041684b5 100644 (file)
@@ -31,7 +31,6 @@ struct buffer;
 struct session;
 struct appctx;
 struct stream;
-struct stream_interface;
 struct check;
 
 #define IS_HTX_CS(cs)     (cs_conn(cs) && IS_HTX_CONN(__cs_conn(cs)))
@@ -132,6 +131,7 @@ static inline struct stream *__cs_strm(const struct conn_stream *cs)
 {
        return __objt_stream(cs->app);
 }
+
 static inline struct stream *cs_strm(const struct conn_stream *cs)
 {
        if (obj_type(cs->app) == OBJ_TYPE_STREAM)
@@ -153,15 +153,6 @@ static inline struct check *cs_check(const struct conn_stream *cs)
                return __objt_check(cs->app);
        return NULL;
 }
-
-/* Returns the stream-interface from a cs. It is not NULL only if a stream is
- * attached to the cs.
- */
-static inline struct stream_interface *cs_si(const struct conn_stream *cs)
-{
-       return cs->si;
-}
-
 static inline const char *cs_get_data_name(const struct conn_stream *cs)
 {
        if (!cs->data_cb)
index ff1610e6ab70e469d60fd9266bf37700910aef26..1832ff75e68d6c2f3c9d875c819668cc30c12a7c 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2767,7 +2767,6 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                sockaddr_free(&s->csb->dst);
 
                cs_set_state(s->csb, CS_ST_INI);
-               cs_si(s->csb)->flags &= SI_FL_ISBACK; /* we're in the context of process_stream */
                s->csb->flags &= CS_FL_ISBACK | CS_FL_DONT_WAKE; /* we're in the context of process_stream */
                s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WROTE_DATA);
                s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA|CF_READ_NULL);
index c4dd8ab8db63482eda74c609074f578067f4ffab..c3621450c309dbe2b8c148b450e77c5bc887f565 100644 (file)
@@ -19,7 +19,6 @@
 #include <haproxy/http_ana.h>
 #include <haproxy/pipe.h>
 #include <haproxy/pool.h>
-#include <haproxy/stream_interface.h>
 
 DECLARE_POOL(pool_head_connstream, "conn_stream", sizeof(struct conn_stream));
 DECLARE_POOL(pool_head_cs_endpoint, "cs_endpoint", sizeof(struct cs_endpoint));
@@ -124,7 +123,6 @@ struct conn_stream *cs_new(struct cs_endpoint *endp)
        cs->state = CS_ST_INI;
        cs->hcto = TICK_ETERNITY;
        cs->app = NULL;
-       cs->si = NULL;
        cs->data_cb = NULL;
        cs->src = NULL;
        cs->dst = NULL;
@@ -186,12 +184,6 @@ struct conn_stream *cs_new_from_strm(struct stream *strm, unsigned int flags)
                return NULL;
        cs->flags |= flags;
        cs->endp->flags |=  CS_EP_DETACHED;
-       cs->si = si_new(cs);
-       if (unlikely(!cs->si)) {
-               cs_free(cs);
-               return NULL;
-       }
-
        cs->app = &strm->obj_type;
        cs->ops = &cs_app_embedded_ops;
        cs->data_cb = NULL;
@@ -217,7 +209,6 @@ struct conn_stream *cs_new_from_check(struct check *check, unsigned int flags)
  */
 void cs_free(struct conn_stream *cs)
 {
-       si_free(cs->si);
        sockaddr_free(&cs->src);
        sockaddr_free(&cs->dst);
        if (cs->endp) {
@@ -279,19 +270,11 @@ void cs_attach_applet(struct conn_stream *cs, void *target, void *ctx)
 int cs_attach_strm(struct conn_stream *cs, struct stream *strm)
 {
        cs->app = &strm->obj_type;
-
-       cs->si = si_new(cs);
-       if (unlikely(!cs->si))
-               return -1;
-
        cs->endp->flags &= ~CS_EP_ORPHAN;
        if (cs->endp->flags & CS_EP_T_MUX) {
                cs->wait_event.tasklet = tasklet_new();
-               if (!cs->wait_event.tasklet) {
-                       si_free(cs->si);
-                       cs->si = NULL;
+               if (!cs->wait_event.tasklet)
                        return -1;
-               }
                cs->wait_event.tasklet->process = cs_conn_io_cb;
                cs->wait_event.tasklet->context = cs;
                cs->wait_event.events = 0;
@@ -363,7 +346,7 @@ void cs_detach_endp(struct conn_stream *cs)
         *        connection related for now but this will evolved
         */
        cs->flags &= CS_FL_ISBACK;
-       if (cs->si)
+       if (cs_strm(cs))
                cs->ops = &cs_app_embedded_ops;
        cs->data_cb = NULL;
 
@@ -373,9 +356,7 @@ void cs_detach_endp(struct conn_stream *cs)
 
 void cs_detach_app(struct conn_stream *cs)
 {
-       si_free(cs->si);
        cs->app = NULL;
-       cs->si  = NULL;
        cs->data_cb = NULL;
        sockaddr_free(&cs->src);
        sockaddr_free(&cs->dst);
index 62efca6111a35190d88691687c4eee8b09268b35..0075db67ffeff3dbabc95d77c19ec09d628a5234 100644 (file)
@@ -693,7 +693,7 @@ static int debug_parse_cli_stream(char **args, char *payload, struct appctx *app
        if (!*args[3]) {
                return cli_err(appctx,
                               "Usage: debug dev stream { <obj> <op> <value> | wake }*\n"
-                              "     <obj>   = {strm | strm.f | strm.x | sif.f | csf.s | sib.f | csb.s |\n"
+                              "     <obj>   = {strm | strm.f | strm.x | csf.s | csb.s |\n"
                               "                txn.f | req.f | req.r | req.w | res.f | res.r | res.w}\n"
                               "     <op>    = {'' (show) | '=' (assign) | '^' (xor) | '+' (or) | '-' (andnot)}\n"
                               "     <value> = 'now' | 64-bit dec/hex integer (0x prefix supported)\n"
@@ -728,10 +728,6 @@ static int debug_parse_cli_stream(char **args, char *payload, struct appctx *app
                        ptr = (!s || !may_access(s)) ? NULL : &s->req.wex; size = sizeof(s->req.wex);
                } else if (isteq(name, ist("res.w"))) {
                        ptr = (!s || !may_access(s)) ? NULL : &s->res.wex; size = sizeof(s->res.wex);
-               } else if (isteq(name, ist("sif.f"))) {
-                       ptr = (!s || !may_access(s)) ? NULL : &cs_si(s->csf)->flags; size = sizeof(cs_si(s->csf)->flags);
-               } else if (isteq(name, ist("sib.f"))) {
-                       ptr = (!s || !may_access(s)) ? NULL : &cs_si(s->csb)->flags; size = sizeof(cs_si(s->csb)->flags);
                } else if (isteq(name, ist("csf.s"))) {
                        ptr = (!s || !may_access(s)) ? NULL : &s->csf->state; size = sizeof(s->csf->state);
                } else if (isteq(name, ist("csb.s"))) {