From 0cd3bd628a0514113a67dd00fb0009c4ba611d8f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 6 Nov 2018 18:46:37 +0100 Subject: [PATCH] MINOR: stream-int: rename si_applet_{want|stop|cant}_{get|put} It doesn't make sense to limit this code to applets, as any stream interface can use it. Let's rename it by simply dropping the "applet_" part of the name. No other change was made except updating the comments. --- include/proto/stream_interface.h | 28 +++++++---------- include/types/stream_interface.h | 8 ++--- src/applet.c | 6 ++-- src/cache.c | 8 ++--- src/cli.c | 22 ++++++------- src/flt_spoe.c | 10 +++--- src/hlua.c | 54 ++++++++++++++++---------------- src/log.c | 2 +- src/map.c | 8 ++--- src/memory.c | 2 +- src/peers.c | 4 +-- src/proxy.c | 10 +++--- src/server.c | 2 +- src/ssl_sock.c | 6 ++-- src/stats.c | 42 ++++++++++++------------- src/stick_table.c | 4 +-- src/stream.c | 14 ++++----- src/stream_interface.c | 2 +- 18 files changed, 114 insertions(+), 118 deletions(-) diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index 4e400399b..f636094ed 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -248,42 +248,38 @@ static inline void si_applet_release(struct stream_interface *si) appctx->applet->release(appctx); } -/* let an applet indicate that it wants to put some data into the input buffer */ -static inline void si_applet_want_put(struct stream_interface *si) +/* Report that a stream interface wants to put some data into the input buffer */ +static inline void si_want_put(struct stream_interface *si) { si->flags |= SI_FL_WANT_PUT; } -/* let an applet indicate that it wanted to put some data into the input buffer - * but it couldn't. - */ -static inline void si_applet_cant_put(struct stream_interface *si) +/* Report that a stream interface failed to put some data into the input buffer */ +static inline void si_cant_put(struct stream_interface *si) { si->flags |= SI_FL_WANT_PUT | SI_FL_WAIT_ROOM; } -/* let an applet indicate that it doesn't want to put data into the input buffer */ -static inline void si_applet_stop_put(struct stream_interface *si) +/* Report that a stream interface doesn't want to put data into the input buffer */ +static inline void si_stop_put(struct stream_interface *si) { si->flags &= ~SI_FL_WANT_PUT; } -/* let an applet indicate that it wants to get some data from the output buffer */ -static inline void si_applet_want_get(struct stream_interface *si) +/* Report that a stream interface wants to get some data from the output buffer */ +static inline void si_want_get(struct stream_interface *si) { si->flags |= SI_FL_WANT_GET; } -/* let an applet indicate that it wanted to get some data from the output buffer - * but it couldn't. - */ -static inline void si_applet_cant_get(struct stream_interface *si) +/* Report that a stream interface failed to get some data from the output buffer */ +static inline void si_cant_get(struct stream_interface *si) { si->flags |= SI_FL_WANT_GET | SI_FL_WAIT_DATA; } -/* let an applet indicate that it doesn't want to get data from the input buffer */ -static inline void si_applet_stop_get(struct stream_interface *si) +/* Report that a stream interface doesn't want to get data from the output buffer */ +static inline void si_stop_get(struct stream_interface *si) { si->flags &= ~SI_FL_WANT_GET; } diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h index 76ed72eea..3a9895e60 100644 --- a/include/types/stream_interface.h +++ b/include/types/stream_interface.h @@ -64,16 +64,16 @@ enum { SI_FL_NONE = 0x0000, /* nothing */ SI_FL_EXP = 0x0001, /* timeout has expired */ SI_FL_ERR = 0x0002, /* a non-recoverable error has occurred */ - SI_FL_WAIT_ROOM = 0x0004, /* waiting for space to store incoming data */ - SI_FL_WAIT_DATA = 0x0008, /* waiting for more data to send */ + SI_FL_WAIT_ROOM = 0x0004, /* stream-int waits for space to store incoming data */ + SI_FL_WAIT_DATA = 0x0008, /* stream-int waits for more outgoing data to send */ SI_FL_ISBACK = 0x0010, /* 0 for front-side SI, 1 for back-side */ SI_FL_DONT_WAKE = 0x0020, /* resync in progress, don't wake up */ SI_FL_INDEP_STR = 0x0040, /* independent streams = don't update rex on write */ SI_FL_NOLINGER = 0x0080, /* may close without lingering. One-shot. */ SI_FL_NOHALF = 0x0100, /* no half close, close both sides at once */ SI_FL_SRC_ADDR = 0x1000, /* get the source ip/port with getsockname */ - SI_FL_WANT_PUT = 0x2000, /* an applet would like to put some data into the buffer */ - SI_FL_WANT_GET = 0x4000, /* an applet would like to get some data from the buffer */ + SI_FL_WANT_PUT = 0x2000, /* a stream-int would like to put some data into the buffer */ + SI_FL_WANT_GET = 0x4000, /* a stream-int would like to get some data from the buffer */ SI_FL_CLEAN_ABRT = 0x8000, /* SI_FL_ERR is used to report aborts, and not SHUTR */ }; diff --git a/src/applet.c b/src/applet.c index 69e13c5c8..3017bf4e1 100644 --- a/src/applet.c +++ b/src/applet.c @@ -63,14 +63,14 @@ struct task *task_run_applet(struct task *t, void *context, unsigned short state * check if this buffer was allocated or not. This let a chance * for applets to do some other processing if needed. */ if (!si_alloc_ibuf(si, &app->buffer_wait)) - si_applet_cant_put(si); + si_cant_put(si); /* We always pretend the applet can't get and doesn't want to * put, it's up to it to change this if needed. This ensures * that one applet which ignores any event will not spin. */ - si_applet_cant_get(si); - si_applet_stop_put(si); + si_cant_get(si); + si_stop_put(si); app->applet->fct(app); si_applet_wake_cb(si); diff --git a/src/cache.c b/src/cache.c index 96a251ae0..6988b15be 100644 --- a/src/cache.c +++ b/src/cache.c @@ -617,7 +617,7 @@ static int cache_channel_row_data_get(struct appctx *appctx, int len) offset = 0; if (ret <= 0) { if (ret == -3 || ret == -1) { - si_applet_cant_put(si); + si_cant_put(si); break; } return -1; @@ -644,7 +644,7 @@ static void http_cache_io_handler(struct appctx *appctx) /* Check if the input buffer is avalaible. */ if (res->buf.size == 0) { - si_applet_cant_put(si); + si_cant_put(si); goto out; } @@ -1140,7 +1140,7 @@ static int cli_io_handler_show_cache(struct appctx *appctx) if (!next_key) { chunk_printf(&trash, "%p: %s (shctx:%p, available blocks:%d)\n", cache, cache->id, shctx_ptr(cache), shctx_ptr(cache)->nbav); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -1166,7 +1166,7 @@ static int cli_io_handler_show_cache(struct appctx *appctx) shctx_unlock(shctx_ptr(cache)); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } diff --git a/src/cli.c b/src/cli.c index e20e0c5bd..85e344d30 100644 --- a/src/cli.c +++ b/src/cli.c @@ -550,7 +550,7 @@ static void cli_io_handler(struct appctx *appctx) /* Check if the input buffer is avalaible. */ if (res->buf.size == 0) { - si_applet_cant_put(si); + si_cant_put(si); goto out; } @@ -588,7 +588,7 @@ static void cli_io_handler(struct appctx *appctx) * would want to return some info right after parsing. */ if (buffer_almost_full(si_ib(si))) { - si_applet_cant_put(si); + si_cant_put(si); break; } @@ -691,7 +691,7 @@ static void cli_io_handler(struct appctx *appctx) cli_get_severity_output(appctx)) != -1) appctx->st0 = CLI_ST_PROMPT; else - si_applet_cant_put(si); + si_cant_put(si); break; case CLI_ST_PRINT_FREE: { const char *msg = appctx->ctx.cli.err; @@ -704,7 +704,7 @@ static void cli_io_handler(struct appctx *appctx) appctx->st0 = CLI_ST_PROMPT; } else - si_applet_cant_put(si); + si_cant_put(si); break; } case CLI_ST_CALLBACK: /* use custom pointer */ @@ -744,7 +744,7 @@ static void cli_io_handler(struct appctx *appctx) if (ci_putstr(si_ic(si), prompt) != -1) appctx->st0 = CLI_ST_GETREQ; else - si_applet_cant_put(si); + si_cant_put(si); } /* If the output functions are still there, it means they require more room. */ @@ -832,7 +832,7 @@ static int cli_io_handler_show_env(struct appctx *appctx) chunk_printf(&trash, "%s\n", *var); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } if (appctx->st2 == STAT_ST_END) @@ -949,7 +949,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx) chunk_appendf(&trash, "\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } skip: @@ -1006,7 +1006,7 @@ static int cli_io_handler_show_activity(struct appctx *appctx) if (ci_putchk(si_ic(si), &trash) == -1) { chunk_reset(&trash); chunk_printf(&trash, "[output too large, cannot dump]\n"); - si_applet_cant_put(si); + si_cant_put(si); } /* dump complete */ @@ -1028,7 +1028,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx) case STAT_ST_INIT: chunk_printf(&trash, "# socket lvl processes\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } appctx->st2 = STAT_ST_LIST; @@ -1097,7 +1097,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx) } if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -1411,7 +1411,7 @@ static int cli_io_handler_show_proc(struct appctx *appctx) } if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 81af855fd..cd0b88a94 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -1156,7 +1156,7 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz) ret = ci_putblk(si_ic(si), buf, framesz+4); if (ret <= 0) { if ((ret == -3 && b_is_null(&si_ic(si)->buf)) || ret == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 1; /* retry */ } SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO; @@ -1200,8 +1200,8 @@ spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz) static int spoe_wakeup_appctx(struct appctx *appctx) { - si_applet_want_get(appctx->owner); - si_applet_want_put(appctx->owner); + si_want_get(appctx->owner); + si_want_put(appctx->owner); appctx_wakeup(appctx); return 1; } @@ -1338,7 +1338,7 @@ spoe_handle_connect_appctx(struct appctx *appctx) int ret; if (si->state <= SI_ST_CON) { - si_applet_want_put(si); + si_want_put(si); task_wakeup(si_strm(si)->task, TASK_WOKEN_MSG); goto stop; } @@ -1997,7 +1997,7 @@ spoe_create_appctx(struct spoe_config *conf) stream_set_backend(strm, conf->agent->b.be); /* applet is waiting for data */ - si_applet_cant_get(&strm->si[0]); + si_cant_get(&strm->si[0]); appctx_wakeup(appctx); strm->do_log = NULL; diff --git a/src/hlua.c b/src/hlua.c index 6ad3c822d..f2b950786 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -1614,8 +1614,8 @@ static void hlua_socket_handler(struct appctx *appctx) * to be notified whenever the connection completes. */ if (!(c->flags & CO_FL_CONNECTED)) { - si_applet_cant_get(si); - si_applet_cant_put(si); + si_cant_get(si); + si_cant_put(si); return; } @@ -1640,7 +1640,7 @@ static void hlua_socket_handler(struct appctx *appctx) * to write, so we set the flag cant put */ if (notification_registered(&appctx->ctx.hlua_cosocket.wake_on_write)) - si_applet_cant_put(si); + si_cant_put(si); } /* This function is called when the "struct stream" is destroyed. @@ -2479,8 +2479,8 @@ __LJMP static int hlua_socket_connect(struct lua_State *L) /* inform the stream that we want to be notified whenever the * connection completes. */ - si_applet_cant_get(&s->si[0]); - si_applet_cant_put(&s->si[0]); + si_cant_get(&s->si[0]); + si_cant_put(&s->si[0]); appctx_wakeup(appctx); hlua->flags |= HLUA_MUST_GC; @@ -2942,7 +2942,7 @@ __LJMP static int hlua_channel_append_yield(lua_State *L, int status, lua_KConte * the request buffer if its not required. */ if (chn->buf.size == 0) { - si_applet_cant_put(chn_prod(chn)); + si_cant_put(chn_prod(chn)); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_channel_append_yield, TICK_ETERNITY, 0)); } @@ -3036,7 +3036,7 @@ __LJMP static int hlua_channel_send_yield(lua_State *L, int status, lua_KContext * the request buffer if its not required. */ if (chn->buf.size == 0) { - si_applet_cant_put(chn_prod(chn)); + si_cant_put(chn_prod(chn)); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_channel_send_yield, TICK_ETERNITY, 0)); } @@ -3662,7 +3662,7 @@ __LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KC /* Data not yet avalaible. return yield. */ if (ret == 0) { - si_applet_cant_get(si); + si_cant_get(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_getline_yield, TICK_ETERNITY, 0)); } @@ -3717,7 +3717,7 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont /* Data not yet avalaible. return yield. */ if (ret == 0) { - si_applet_cant_get(si); + si_cant_get(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0)); } @@ -3740,7 +3740,7 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont luaL_addlstring(&appctx->b, blk1, len1); luaL_addlstring(&appctx->b, blk2, len2); co_skip(si_oc(si), len1 + len2); - si_applet_cant_get(si); + si_cant_get(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0)); } else { @@ -3764,7 +3764,7 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont if (len > 0) { lua_pushinteger(L, len); lua_replace(L, 2); - si_applet_cant_get(si); + si_cant_get(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0)); } @@ -3833,7 +3833,7 @@ __LJMP static int hlua_applet_tcp_send_yield(lua_State *L, int status, lua_KCont * applet, and returns a yield. */ if (l < len) { - si_applet_cant_put(si); + si_cant_put(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_send_yield, TICK_ETERNITY, 0)); } @@ -4130,7 +4130,7 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K * If ret is -1, we dont have room in the buffer, so we yield. */ if (ret == -1) { - si_applet_cant_put(si); + si_cant_put(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_getline_yield, TICK_ETERNITY, 0)); } appctx->appctx->ctx.hlua_apphttp.flags &= ~APPLET_100C; @@ -4147,7 +4147,7 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K /* Data not yet avalaible. return yield. */ if (ret == 0) { - si_applet_cant_get(si); + si_cant_get(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_getline_yield, TICK_ETERNITY, 0)); } @@ -4216,7 +4216,7 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon * If ret is -1, we dont have room in the buffer, so we yield. */ if (ret == -1) { - si_applet_cant_put(si); + si_cant_put(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_recv_yield, TICK_ETERNITY, 0)); } appctx->appctx->ctx.hlua_apphttp.flags &= ~APPLET_100C; @@ -4227,7 +4227,7 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon /* Data not yet avalaible. return yield. */ if (ret == 0) { - si_applet_cant_get(si); + si_cant_get(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_recv_yield, TICK_ETERNITY, 0)); } @@ -4262,7 +4262,7 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon if (len > 0) { lua_pushinteger(L, len); lua_replace(L, 2); - si_applet_cant_get(si); + si_cant_get(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_recv_yield, TICK_ETERNITY, 0)); } @@ -4328,7 +4328,7 @@ __LJMP static int hlua_applet_http_send_yield(lua_State *L, int status, lua_KCon * applet, and returns a yield. */ if (l < len) { - si_applet_cant_put(si); + si_cant_put(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_send_yield, TICK_ETERNITY, 0)); } @@ -4468,7 +4468,7 @@ __LJMP static int hlua_applet_http_start_response_yield(lua_State *L, int status /* If ret is -1, we dont have room in the buffer, so we yield. */ if (ret == -1) { - si_applet_cant_put(si); + si_cant_put(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_start_response_yield, TICK_ETERNITY, 0)); } @@ -6337,7 +6337,7 @@ struct task *hlua_applet_wakeup(struct task *t, void *context, unsigned short st * will send some data and after call the applet, otherwise it call * the applet ASAP. */ - si_applet_cant_put(si); + si_cant_put(si); appctx_wakeup(ctx); t->expire = TICK_ETERNITY; return t; @@ -6433,8 +6433,8 @@ static int hlua_applet_tcp_init(struct appctx *ctx, struct proxy *px, struct str RESET_SAFE_LJMP(hlua->T); /* Wakeup the applet ASAP. */ - si_applet_cant_get(si); - si_applet_cant_put(si); + si_cant_get(si); + si_cant_put(si); return 1; } @@ -6656,7 +6656,7 @@ static int hlua_applet_http_init(struct appctx *ctx, struct proxy *px, struct st RESET_SAFE_LJMP(hlua->T); /* Wakeup the applet when data is ready for read. */ - si_applet_cant_get(si); + si_cant_get(si); return 1; } @@ -6685,7 +6685,7 @@ static void hlua_applet_http_fct(struct appctx *ctx) /* Wait for full HTTP analysys. */ if (unlikely(strm->txn->req.msg_state < HTTP_MSG_BODY)) { - si_applet_cant_get(si); + si_cant_get(si); return; } @@ -6707,7 +6707,7 @@ static void hlua_applet_http_fct(struct appctx *ctx) if (ret == 0) len1 = 0; if (len1 + len2 < strm->txn->req.eoh + strm->txn->req.eol) { - si_applet_cant_get(si); + si_cant_get(si); return; } @@ -6783,7 +6783,7 @@ static void hlua_applet_http_fct(struct appctx *ctx) /* no enough space error. */ if (ret == -1) { - si_applet_cant_put(si); + si_cant_put(si); return; } @@ -7232,7 +7232,7 @@ static int hlua_cli_io_handler_fct(struct appctx *appctx) case HLUA_E_AGAIN: /* We want write. */ if (HLUA_IS_WAKERESWR(hlua)) - si_applet_cant_put(si); + si_cant_put(si); /* Set the timeout. */ if (hlua->wake_time != TICK_ETERNITY) task_schedule(hlua->task, hlua->wake_time); diff --git a/src/log.c b/src/log.c index cd9ff01b9..8edb1b7cd 100644 --- a/src/log.c +++ b/src/log.c @@ -2721,7 +2721,7 @@ static int cli_io_handler_show_startup_logs(struct appctx *appctx) const char *msg = (startup_logs ? startup_logs : "No startup alerts/warnings.\n"); if (ci_putstr(si_ic(si), msg) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } return 1; diff --git a/src/map.c b/src/map.c index d94b0f260..859ad8907 100644 --- a/src/map.c +++ b/src/map.c @@ -381,7 +381,7 @@ static int cli_io_handler_pat_list(struct appctx *appctx) */ LIST_ADDQ(&elt->back_refs, &appctx->ctx.map.bref.users); HA_SPIN_UNLOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock); - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -410,7 +410,7 @@ static int cli_io_handler_pats_list(struct appctx *appctx) chunk_reset(&trash); chunk_appendf(&trash, "# id (file) description\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -440,7 +440,7 @@ static int cli_io_handler_pats_list(struct appctx *appctx) /* let's try again later from this stream. We add ourselves into * this stream's users so that it can remove us upon termination. */ - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -561,7 +561,7 @@ static int cli_io_handler_map_lookup(struct appctx *appctx) * this stream's users so that it can remove us upon termination. */ HA_SPIN_UNLOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock); - si_applet_cant_put(si); + si_cant_put(si); return 0; } diff --git a/src/memory.c b/src/memory.c index c4ba54edf..ced9af550 100644 --- a/src/memory.c +++ b/src/memory.c @@ -514,7 +514,7 @@ static int cli_io_handler_dump_pools(struct appctx *appctx) dump_pools_to_trash(); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } return 1; diff --git a/src/peers.c b/src/peers.c index 8a8e8900e..649af83ff 100644 --- a/src/peers.c +++ b/src/peers.c @@ -1892,7 +1892,7 @@ out: HA_SPIN_UNLOCK(PEER_LOCK, &curpeer->lock); return; full: - si_applet_cant_put(si); + si_cant_put(si); goto out; } @@ -1980,7 +1980,7 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer s->flags = SF_ASSIGNED|SF_ADDR_SET; /* applet is waiting for data */ - si_applet_cant_get(&s->si[0]); + si_cant_get(&s->si[0]); appctx_wakeup(appctx); /* initiate an outgoing connection */ diff --git a/src/proxy.c b/src/proxy.c index 9a6313a1c..f3208ef20 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1574,7 +1574,7 @@ static int dump_servers_state(struct stream_interface *si, struct buffer *buf) bk_f_forced_id, srv_f_forced_id, srv->hostname ? srv->hostname : "-", srv->svc_port, srvrecord ? srvrecord : "-"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -1601,7 +1601,7 @@ static int cli_io_handler_servers_state(struct appctx *appctx) if (appctx->st2 == STAT_ST_HEAD) { chunk_printf(&trash, "%d\n# %s\n", SRV_STATE_FILE_VERSION, SRV_STATE_FILE_FIELD_NAMES); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } appctx->st2 = STAT_ST_INFO; @@ -1636,7 +1636,7 @@ static int cli_io_handler_show_backend(struct appctx *appctx) if (!appctx->ctx.cli.p0) { chunk_printf(&trash, "# name\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } appctx->ctx.cli.p0 = proxies_list; @@ -1655,7 +1655,7 @@ static int cli_io_handler_show_backend(struct appctx *appctx) chunk_appendf(&trash, "%s\n", curproxy->id); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -2148,7 +2148,7 @@ static int cli_io_handler_show_errors(struct appctx *appctx) cant_send_unlock: HA_SPIN_UNLOCK(PROXY_LOCK, &appctx->ctx.errors.px->lock); cant_send: - si_applet_cant_put(si); + si_cant_put(si); return 0; } diff --git a/src/server.c b/src/server.c index 8d0ae7420..47eaee6a9 100644 --- a/src/server.c +++ b/src/server.c @@ -4460,7 +4460,7 @@ static int cli_parse_get_weight(char **args, char *payload, struct appctx *appct snprintf(trash.area, trash.size, "%d (initial %d)\n", sv->uweight, sv->iweight); if (ci_putstr(si_ic(si), trash.area) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } return 1; diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 50af63b20..39d599cfd 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -8571,7 +8571,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) { chunk_appendf(&trash, "# id (file)\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -8620,7 +8620,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) { * this stream's users so that it can remove us upon termination. */ HA_RWLOCK_RDUNLOCK(TLSKEYS_REF_LOCK, &ref->lock); - si_applet_cant_put(si); + si_cant_put(si); return 0; } appctx->ctx.cli.i1++; @@ -8632,7 +8632,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) { /* let's try again later from this stream. We add ourselves into * this stream's users so that it can remove us upon termination. */ - si_applet_cant_put(si); + si_cant_put(si); return 0; } diff --git a/src/stats.c b/src/stats.c index 7ac18d0d9..78342cde7 100644 --- a/src/stats.c +++ b/src/stats.c @@ -2032,7 +2032,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st if (appctx->ctx.stats.flags & STAT_FMT_HTML) { stats_dump_html_px_hdr(si, px, uri); if (ci_putchk(rep, &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -2044,7 +2044,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* print the frontend */ if (stats_dump_fe_stats(si, px)) { if (ci_putchk(rep, &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -2057,7 +2057,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* stats.l has been initialized above */ for (; appctx->ctx.stats.l != &px->conf.listeners; appctx->ctx.stats.l = l->by_fe.n) { if (buffer_almost_full(&rep->buf)) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -2076,7 +2076,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* print the frontend */ if (stats_dump_li_stats(si, px, l, flags)) { if (ci_putchk(rep, &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -2090,7 +2090,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* stats.sv has been initialized above */ for (; appctx->ctx.stats.sv != NULL; appctx->ctx.stats.sv = sv->next) { if (buffer_almost_full(&rep->buf)) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -2120,7 +2120,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st if (stats_dump_sv_stats(si, px, flags, sv)) { if (ci_putchk(rep, &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -2133,7 +2133,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* print the backend */ if (stats_dump_be_stats(si, px, flags)) { if (ci_putchk(rep, &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -2145,7 +2145,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st if (appctx->ctx.stats.flags & STAT_FMT_HTML) { stats_dump_html_px_end(si, px); if (ci_putchk(rep, &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -2557,7 +2557,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut stats_dump_csv_header(); if (ci_putchk(rep, &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -2568,7 +2568,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut if (appctx->ctx.stats.flags & STAT_FMT_HTML) { stats_dump_html_info(si, uri); if (ci_putchk(rep, &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -2582,7 +2582,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut /* dump proxies */ while (appctx->ctx.stats.px) { if (buffer_almost_full(&rep->buf)) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -2607,7 +2607,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut else stats_dump_json_end(); if (ci_putchk(rep, &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } } @@ -2977,7 +2977,7 @@ static int stats_send_http_headers(struct stream_interface *si) chunk_appendf(&trash, "\r\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -3022,7 +3022,7 @@ static int stats_send_http_redirect(struct stream_interface *si) scope_txt); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -3047,7 +3047,7 @@ static void http_stats_io_handler(struct appctx *appctx) /* Check if the input buffer is avalaible. */ if (res->buf.size == 0) { - si_applet_cant_put(si); + si_cant_put(si); goto out; } @@ -3081,7 +3081,7 @@ static void http_stats_io_handler(struct appctx *appctx) si_ic(si)->to_forward = 0; chunk_printf(&trash, "\r\n000000\r\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); si_ic(si)->to_forward = last_fwd; goto out; } @@ -3107,7 +3107,7 @@ static void http_stats_io_handler(struct appctx *appctx) if (last_len != data_len) { chunk_printf(&trash, "\r\n%06x\r\n", (last_len - data_len)); if (ci_putchk(si_ic(si), &trash) == -1) - si_applet_cant_put(si); + si_cant_put(si); si_ic(si)->total += (last_len - data_len); b_add(si_ib(si), last_len - data_len); @@ -3133,7 +3133,7 @@ static void http_stats_io_handler(struct appctx *appctx) if (appctx->ctx.stats.flags & STAT_CHUNKED) { chunk_printf(&trash, "\r\n0\r\n\r\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); goto out; } } @@ -3161,7 +3161,7 @@ static void http_stats_io_handler(struct appctx *appctx) * emitting large blocks into small TCP windows. */ if (!channel_is_empty(res)) - si_applet_stop_get(si); + si_stop_get(si); } /* Dump all fields from into using the "show info" format (name: value) */ @@ -3327,7 +3327,7 @@ static int stats_dump_info_to_buffer(struct stream_interface *si) stats_dump_info_fields(&trash, info); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -3555,7 +3555,7 @@ static int stats_dump_json_schema_to_buffer(struct stream_interface *si) stats_dump_json_schema(&trash); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } diff --git a/src/stick_table.c b/src/stick_table.c index d5d95ec96..7f1416310 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -3048,7 +3048,7 @@ static int table_dump_head_to_buffer(struct buffer *msg, chunk_appendf(msg, "# contents not dumped due to insufficient privileges\n"); if (ci_putchk(si_ic(si), msg) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -3122,7 +3122,7 @@ static int table_dump_entry_to_buffer(struct buffer *msg, chunk_appendf(msg, "\n"); if (ci_putchk(si_ic(si), msg) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } diff --git a/src/stream.c b/src/stream.c index 2dfb2f9be..920c6ad22 100644 --- a/src/stream.c +++ b/src/stream.c @@ -295,7 +295,7 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin) /* finish initialization of the accepted file descriptor */ if (appctx) - si_applet_want_get(&s->si[0]); + si_want_get(&s->si[0]); if (sess->fe->accept && sess->fe->accept(s) < 0) goto out_fail_accept; @@ -1214,7 +1214,7 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px, /* Stops the applet sheduling, in case of the init function miss * some data. */ - si_applet_stop_get(&s->si[1]); + si_stop_get(&s->si[1]); /* Call initialisation. */ if (rule->applet.init) @@ -1225,7 +1225,7 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px, } /* Now we can schedule the applet. */ - si_applet_cant_get(&s->si[1]); + si_cant_get(&s->si[1]); appctx_wakeup(appctx); if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */ @@ -2788,7 +2788,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st /* stream changed, no need to go any further */ chunk_appendf(&trash, " *** session terminated while we were watching it ***\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } appctx->ctx.sess.uid = 0; @@ -3086,7 +3086,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st (unsigned int)strm->res.buf.size); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); return 0; } @@ -3305,7 +3305,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx) /* let's try again later from this stream. We add ourselves into * this stream's users so that it can remove us upon termination. */ - si_applet_cant_put(si); + si_cant_put(si); LIST_ADDQ(&curr_strm->back_refs, &appctx->ctx.sess.bref.users); HA_SPIN_UNLOCK(STRMS_LOCK, &streams_lock); return 0; @@ -3323,7 +3323,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx) chunk_appendf(&trash, "Session not found.\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_applet_cant_put(si); + si_cant_put(si); HA_SPIN_UNLOCK(STRMS_LOCK, &streams_lock); return 0; } diff --git a/src/stream_interface.c b/src/stream_interface.c index e7b69cd28..f2fa79158 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -307,7 +307,7 @@ struct appctx *stream_int_register_handler(struct stream_interface *si, struct a if (!appctx) return NULL; - si_applet_cant_get(si); + si_cant_get(si); appctx_wakeup(appctx); return si_appctx(si); }