/* wakes up an applet when conditions have changed */
static inline void appctx_wakeup(struct appctx *appctx)
{
+ ALREADY_CHECKED(appctx);
+
task_wakeup(appctx->t, TASK_WOKEN_OTHER);
}
static inline struct stream_interface *cs_si(const struct conn_stream *cs)
{
- return (cs_strm(cs) ? cs->si : NULL);
+ return cs->si;
}
static inline const char *cs_get_data_name(const struct conn_stream *cs)
/* returns the channel which receives data from this stream interface (input channel) */
static inline struct channel *si_ic(struct stream_interface *si)
{
- return ((si->flags & SI_FL_ISBACK) ? &(cs_strm(si->cs)->res) : &(cs_strm(si->cs)->req));
+ struct stream *strm = cs_strm(si->cs);
+
+ ALREADY_CHECKED(strm);
+ return ((si->flags & SI_FL_ISBACK) ? &(strm->res) : &(strm->req));
}
/* returns the channel which feeds data to this stream interface (output channel) */
static inline struct channel *si_oc(struct stream_interface *si)
{
- return ((si->flags & SI_FL_ISBACK) ? &(cs_strm(si->cs)->req) : &(cs_strm(si->cs)->res));
+ struct stream *strm = cs_strm(si->cs);
+
+ ALREADY_CHECKED(strm);
+ return ((si->flags & SI_FL_ISBACK) ? &(strm->req) : &(strm->res));
}
/* returns the buffer which receives data from this stream interface (input channel's buffer) */
/* returns the stream associated to a stream interface */
static inline struct stream *si_strm(struct stream_interface *si)
{
- return cs_strm(si->cs);
+ struct stream *strm = cs_strm(si->cs);
+
+ ALREADY_CHECKED(strm);
+ return strm;
}
/* returns the task associated to this stream interface */
static inline struct task *si_task(struct stream_interface *si)
{
- return cs_strm(si->cs)->task;
+ struct stream *strm = cs_strm(si->cs);
+
+ ALREADY_CHECKED(strm);
+ return strm->task;
}
/* returns the stream interface on the other side. Used during forwarding. */
static inline struct stream_interface *si_opposite(struct stream_interface *si)
{
- return ((si->flags & SI_FL_ISBACK) ? cs_strm(si->cs)->csf->si : cs_strm(si->cs)->csb->si);
+ struct stream *strm = cs_strm(si->cs);
+
+ ALREADY_CHECKED(strm);
+ return ((si->flags & SI_FL_ISBACK) ? strm->csf->si : strm->csb->si);
}
/* initializes a stream interface in the SI_ST_INI state and create the event
}
appctx = cs_appctx(s->csf);
+ ALREADY_CHECKED(appctx);
/* Check for connection established. */
if (appctx->ctx.hlua_cosocket.connected) {
struct hlua_appctx *luactx;
struct stream_interface *si = cs_si(ctx->owner);
struct stream *s = si_strm(si);
- struct proxy *p = s->be;
+ struct proxy *p;
+
+ ALREADY_CHECKED(s);
+ p = s->be;
/* Check stack size. */
if (!lua_checkstack(L, 3))
struct htx_sl *sl;
appctx = cs_appctx(s->csb);
+ ALREADY_CHECKED(appctx);
memset(&appctx->ctx.stats, 0, sizeof(appctx->ctx.stats));
appctx->st1 = appctx->st2 = 0;
appctx->ctx.stats.st_code = STAT_STATUS_INIT;
static void mux_pt_detach(struct conn_stream *cs)
{
struct connection *conn = cs_conn(cs);
- struct mux_pt_ctx *ctx = conn->ctx;
+ struct mux_pt_ctx *ctx;
+
+ ALREADY_CHECKED(conn);
+ ctx = conn->ctx;
TRACE_ENTER(PT_EV_STRM_END, conn, cs);
static int dump_servers_state(struct stream_interface *si)
{
struct appctx *appctx = cs_appctx(si->cs);
- struct proxy *px = appctx->ctx.cli.p0;
+ struct proxy *px;
struct server *srv;
char srv_addr[INET6_ADDRSTRLEN + 1];
char srv_agent_addr[INET6_ADDRSTRLEN + 1];
int bk_f_forced_id, srv_f_forced_id;
char *srvrecord;
+ ALREADY_CHECKED(appctx);
+ px = appctx->ctx.cli.p0;
+
if (!appctx->ctx.cli.p1)
appctx->ctx.cli.p1 = px->srv;
struct stats_module *mod;
size_t stats_count = ST_F_TOTAL_FIELDS;
+ ALREADY_CHECKED(appctx);
+
memset(stats, 0, sizeof(struct field) * stat_count[STATS_DOMAIN_PROXY]);
if (!stats_fill_li_stats(px, l, appctx->ctx.stats.flags, stats,
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
size_t stats_count = ST_F_TOTAL_FIELDS;
+ ALREADY_CHECKED(appctx);
+
memset(stats, 0, sizeof(struct field) * stat_count[STATS_DOMAIN_PROXY]);
if (!stats_fill_sv_stats(px, sv, appctx->ctx.stats.flags, stats,
struct htx_sl *sl;
unsigned int flags;
+ ALREADY_CHECKED(appctx);
+
/* scope_txt = search pattern + search query, appctx->ctx.stats.scope_len is always <= STAT_SCOPE_TXT_MAXLEN */
scope_txt[0] = 0;
if (appctx->ctx.stats.scope_len) {
{
struct appctx *appctx = cs_appctx(si->cs);
+ ALREADY_CHECKED(appctx);
+
if (!stats_fill_info(info, INF_TOTAL_FIELDS, appctx->ctx.stats.flags))
return 0;
if (flags & ACT_OPT_FIRST) {
/* Register applet. this function schedules the applet. */
s->target = &rule->applet.obj_type;
- if (unlikely(!si_register_handler(cs_si(s->csb), objt_applet(s->target))))
+ appctx = si_register_handler(cs_si(s->csb), objt_applet(s->target));
+ if (unlikely(!appctx))
return ACT_RET_ERR;
/* Initialise the context. */
- appctx = cs_appctx(s->csb);
memset(&appctx->ctx, 0, sizeof(appctx->ctx));
appctx->rule = rule;
}
struct connection *conn;
struct appctx *tmpctx;
+ ALREADY_CHECKED(appctx);
+
chunk_reset(&trash);
if (appctx->ctx.sess.section > 0 && appctx->ctx.sess.uid != strm->uniq_id) {