CLEANUP: spoe: do not use appctx.ctx anymore
The spoe code already uses its own generic pointer, let's move it to
svcctx instead of keeping a struct spoe in the appctx union.
diff --git a/include/haproxy/applet-t.h b/include/haproxy/applet-t.h
index 87b25fd..ccedad0 100644
--- a/include/haproxy/applet-t.h
+++ b/include/haproxy/applet-t.h
@@ -112,9 +112,6 @@
struct task *task;
} hlua_apphttp; /* used by the Lua HTTP services */
struct {
- void *ptr; /* private pointer for SPOE filter */
- } spoe; /* used by SPOE filter */
- struct {
const char *msg; /* pointer to a persistent message to be returned in CLI_ST_PRINT state */
int severity; /* severity of the message to be returned according to (syslog) rfc5424 */
char *err; /* pointer to a 'must free' message to be returned in CLI_ST_PRINT_FREE state */
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 3f26487..f032e83 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -63,7 +63,7 @@
#define FRAME_HDR_SIZE 32
/* Helper to get SPOE ctx inside an appctx */
-#define SPOE_APPCTX(appctx) ((struct spoe_appctx *)((appctx)->ctx.spoe.ptr))
+#define SPOE_APPCTX(appctx) ((struct spoe_appctx *)((appctx)->svcctx))
/* SPOE filter id. Used to identify SPOE filters */
const char *spoe_filter_id = "SPOE filter";
@@ -1073,7 +1073,7 @@
memset(&spoe_appctx, 0, sizeof(spoe_appctx));
memset(buf, 0, sizeof(buf));
- appctx.ctx.spoe.ptr = &spoe_appctx;
+ appctx.svcctx = &spoe_appctx;
SPOE_APPCTX(&appctx)->max_frame_size = MAX_FRAME_SIZE;
frame = buf+4; /* Reserved the 4 first bytes for the frame size */
@@ -1112,7 +1112,7 @@
memset(&appctx, 0, sizeof(appctx));
memset(&spoe_appctx, 0, sizeof(spoe_appctx));
- appctx.ctx.spoe.ptr = &spoe_appctx;
+ appctx.svcctx = &spoe_appctx;
SPOE_APPCTX(&appctx)->max_frame_size = MAX_FRAME_SIZE;
if (*frame == SPOE_FRM_T_AGENT_DISCON) {
@@ -1227,7 +1227,7 @@
if (spoe_appctx == NULL)
return;
- appctx->ctx.spoe.ptr = NULL;
+ appctx->svcctx = NULL;
agent = spoe_appctx->agent;
SPOE_PRINTF(stderr, "%d.%06d [SPOE/%-15s] %s: appctx=%p\n",
@@ -1996,7 +1996,7 @@
if ((appctx = appctx_new(&spoe_applet, NULL)) == NULL)
goto out_error;
- appctx->ctx.spoe.ptr = pool_zalloc(pool_head_spoe_appctx);
+ appctx->svcctx = pool_zalloc(pool_head_spoe_appctx);
if (SPOE_APPCTX(appctx) == NULL)
goto out_free_appctx;