Commit 686b530d authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Avoid a potential PRIV_TASK collision in vmod_debug

You never know what the next test case will look like...
parent 044809d6
......@@ -269,12 +269,12 @@ Set the client socket' send buffer size to *sndbuf*. The previous, desired
and actual values appear in the logs. Not currently implemented for backend
transactions.
$Function VOID store_ip(PRIV_TASK, IP)
$Function VOID store_ip(IP)
Store an IP address to be later found by ``debug.get_ip()`` in the same
transaction.
$Function IP get_ip(PRIV_TASK)
$Function IP get_ip()
Get the IP address previously stored by ``debug.store_ip()`` in the same
transaction.
......
......@@ -922,29 +922,37 @@ xyzzy_sndbuf(VRT_CTX, VCL_BYTES arg)
}
VCL_VOID
xyzzy_store_ip(VRT_CTX, struct vmod_priv *priv, VCL_IP ip)
xyzzy_store_ip(VRT_CTX, VCL_IP ip)
{
struct vmod_priv *priv;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(priv);
priv = VRT_priv_task(ctx, xyzzy_store_ip);
if (priv == NULL) {
VRT_fail(ctx, "no priv task - out of ws?");
return;
}
AZ(priv->free);
assert(VSA_Sane(ip));
priv->priv = TRUST_ME(ip);
}
VCL_IP
xyzzy_get_ip(VRT_CTX, struct vmod_priv *priv)
xyzzy_get_ip(VRT_CTX)
{
struct vmod_priv *priv;
VCL_IP ip;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
priv = VRT_priv_task(ctx, xyzzy_store_ip);
AN(priv);
AZ(priv->free);
ip = priv->priv;
assert(VSA_Sane(ip));
return (ip);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment