MINOR: conn-stream: Remove the stream-interface from the conn-stream

The stream-interface API is no longer used. Thus, it is removed from the
conn-stream. From now, stream-interfaces are now longer used !
This commit is contained in:
Christopher Faulet 2022-04-04 11:25:59 +02:00
parent c77ceb6ad1
commit 582a226a2c
5 changed files with 4 additions and 40 deletions

View 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 */

View 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)

View File

@ -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);

View 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);

View 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"))) {