This will be needed so that we can schedule applets out of the streams.
For now nothing calls the queue yet.
src/arg.o src/stick_table.o src/proto_uxst.o src/connection.o \
src/proto_http.o src/raw_sock.o src/appsession.o src/backend.o \
src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o src/lb_fas.o \
- src/stream_interface.o src/dumpstats.o src/proto_tcp.o \
+ src/stream_interface.o src/dumpstats.o src/proto_tcp.o src/applet.o \
src/session.o src/stream.o src/hdr_idx.o src/ev_select.o src/signal.o \
src/acl.o src/sample.o src/memory.o src/freq_ctr.o src/auth.o \
src/compression.o src/payload.o src/hash.o src/pattern.o src/map.o \
#include <stdlib.h>
#include <common/config.h>
+#include <common/mini-clist.h>
#include <types/applet.h>
#include <proto/connection.h>
+extern struct list applet_runq;
+
/* Initializes all required fields for a new appctx. Note that it does the
* minimum acceptable initialization for an appctx. This means only the
* 3 integer states st0, st1, st2 are zeroed.
appctx->obj_type = OBJ_TYPE_APPCTX;
appctx->applet = applet;
appctx_init(appctx);
+ LIST_INIT(&appctx->runq);
}
return appctx;
}
*/
static inline void appctx_free(struct appctx *appctx)
{
+ if (!LIST_ISEMPTY(&appctx->runq))
+ LIST_DEL(&appctx->runq);
pool_free2(pool2_connection, appctx);
}
+/* wakes up an applet when conditions have changed */
+static inline void appctx_wakeup(struct appctx *appctx)
+{
+ if (LIST_ISEMPTY(&appctx->runq))
+ LIST_ADDQ(&applet_runq, &appctx->runq);
+}
+
#endif /* _PROTO_APPLET_H */
/*
/* Context of a running applet. */
struct appctx {
+ struct list runq; /* chaining in the applet run queue */
enum obj_type obj_type; /* OBJ_TYPE_APPCTX */
/* 3 unused bytes here */
unsigned int st0; /* CLI state for stats, session state for peers */
--- /dev/null
+/*
+ * Functions managing applets
+ *
+ * Copyright 2000-2015 Willy Tarreau <w@1wt.eu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <common/config.h>
+#include <common/mini-clist.h>
+#include <proto/applet.h>
+
+
+struct list applet_runq = LIST_HEAD_INIT(applet_runq);