]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int/conn-stream: Move si_cs_io_cb() in the conn-stream scope
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 1 Apr 2022 14:58:52 +0000 (16:58 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Apr 2022 13:10:15 +0000 (15:10 +0200)
si_cs_io_cb() is renamed cs_conn_io_cb(). In addition, the context of the
tasklet used to wake-up the conn-stream is now a conn-stream.

include/haproxy/stream_interface.h
src/conn_stream.c
src/debug.c
src/stream_interface.c
src/tools.c

index a9adb8719eb08644eba58cd7bc58841a1beac825..6552713f2df899f985bf4d122a05f44afca48706 100644 (file)
@@ -38,7 +38,7 @@ void si_free(struct stream_interface *si);
 
 /* main event functions used to move data between sockets and buffers */
 int cs_applet_process(struct conn_stream *cs);
-struct task *si_cs_io_cb(struct task *t, void *ctx, unsigned int state);
+struct task *cs_conn_io_cb(struct task *t, void *ctx, unsigned int state);
 int si_sync_recv(struct stream_interface *si);
 void si_sync_send(struct stream_interface *si);
 
index 352624dc91e61ce752376a85f2cf58d12e3bb7a3..7f72e1c616c0de40b5e7f554eee073d5628eac9f 100644 (file)
@@ -227,8 +227,8 @@ int cs_attach_mux(struct conn_stream *cs, void *target, void *ctx)
                        cs->wait_event.tasklet = tasklet_new();
                        if (!cs->wait_event.tasklet)
                                return -1;
-                       cs->wait_event.tasklet->process = si_cs_io_cb;
-                       cs->wait_event.tasklet->context = cs->si;
+                       cs->wait_event.tasklet->process = cs_conn_io_cb;
+                       cs->wait_event.tasklet->context = cs;
                        cs->wait_event.events = 0;
                }
 
@@ -273,8 +273,8 @@ int cs_attach_strm(struct conn_stream *cs, struct stream *strm)
                        cs->si = NULL;
                        return -1;
                }
-               cs->wait_event.tasklet->process = si_cs_io_cb;
-               cs->wait_event.tasklet->context = cs->si;
+               cs->wait_event.tasklet->process = cs_conn_io_cb;
+               cs->wait_event.tasklet->context = cs;
                cs->wait_event.events = 0;
 
                cs->ops = &cs_app_conn_ops;
index 6f482d2b13a95525e10c144ee8cd8864a1f6dcb6..1e83c111eab38c47917a38e1fd948227c76d025e 100644 (file)
@@ -252,8 +252,8 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx)
                s = (struct stream *)task->context;
        else if (task->process == task_run_applet && task->context)
                s = cs_strm(((struct appctx *)task->context)->owner);
-       else if (task->process == si_cs_io_cb && task->context)
-               s = cs_strm(((struct stream_interface *)task->context)->cs);
+       else if (task->process == cs_conn_io_cb && task->context)
+               s = cs_strm(((struct conn_stream *)task->context));
 
        if (s)
                stream_dump(buf, s, pfx, '\n');
index ed0f7ca747a45bc2b6245ba20596571c65242394..42605652c3bf7fc65318c4d12e6ea5b14bd040a1 100644 (file)
@@ -459,23 +459,22 @@ int si_cs_send(struct conn_stream *cs)
  * stream interface. Thus it is always safe to perform a tasklet_wakeup() on a
  * stream interface, as the presence of the CS is checked there.
  */
-struct task *si_cs_io_cb(struct task *t, void *ctx, unsigned int state)
+struct task *cs_conn_io_cb(struct task *t, void *ctx, unsigned int state)
 {
-       struct stream_interface *si = ctx;
-       struct conn_stream *cs = si->cs;
+       struct conn_stream *cs = ctx;
        int ret = 0;
 
        if (!cs_conn(cs))
                return t;
 
-       if (!(cs->wait_event.events & SUB_RETRY_SEND) && !channel_is_empty(si_oc(si)))
+       if (!(cs->wait_event.events & SUB_RETRY_SEND) && !channel_is_empty(cs_oc(cs)))
                ret = si_cs_send(cs);
        if (!(cs->wait_event.events & SUB_RETRY_RECV))
                ret |= si_cs_recv(cs);
        if (ret != 0)
                si_cs_process(cs);
 
-       stream_release_buffers(si_strm(si));
+       stream_release_buffers(__cs_strm(cs));
        return t;
 }
 
index 5d5e1b02d1fc99fd646fee1846eff3dff452d602..f62ba9aa774622f714a4f3e4e749db124456cd02 100644 (file)
@@ -4917,7 +4917,7 @@ const void *resolve_sym_name(struct buffer *buf, const char *pfx, const void *ad
        } fcts[] = {
                { .func = process_stream, .name = "process_stream" },
                { .func = task_run_applet, .name = "task_run_applet" },
-               { .func = si_cs_io_cb, .name = "si_cs_io_cb" },
+               { .func = cs_conn_io_cb, .name = "cs_conn_io_cb" },
                { .func = sock_conn_iocb, .name = "sock_conn_iocb" },
                { .func = dgram_fd_handler, .name = "dgram_fd_handler" },
                { .func = listener_accept, .name = "listener_accept" },