Utility function for more thorough VRT_CTX sanity checking

this needs to live within the exclusive circle of cache_vcl.h includers, so I
went for cache_vrt_vcl.c just because of the name.
parent 681c1199
......@@ -313,6 +313,30 @@ VCL_DefaultProbe(const struct vcl *vcl)
/*--------------------------------------------------------------------*/
void
VRT_CTX_Assert(VRT_CTX)
{
CHECK_OBJ_ORNULL(ctx, VRT_CTX_MAGIC);
if (ctx->msg != NULL)
CHECK_OBJ(ctx->msg, VSB_MAGIC);
else
AN(ctx->vsl);
CHECK_OBJ_NOTNULL(ctx->vcl, VCL_MAGIC);
WS_Assert(ctx->ws);
CHECK_OBJ_ORNULL(ctx->sp, SESS_MAGIC);
CHECK_OBJ_ORNULL(ctx->req, REQ_MAGIC);
CHECK_OBJ_ORNULL(ctx->http_req, HTTP_MAGIC);
CHECK_OBJ_ORNULL(ctx->http_req_top, HTTP_MAGIC);
CHECK_OBJ_ORNULL(ctx->http_resp, HTTP_MAGIC);
CHECK_OBJ_ORNULL(ctx->bo, BUSYOBJ_MAGIC);
CHECK_OBJ_ORNULL(ctx->http_bereq, HTTP_MAGIC);
CHECK_OBJ_ORNULL(ctx->http_beresp, HTTP_MAGIC);
}
struct vclref *
VRT_VCL_Prevent_Cold(VRT_CTX, const char *desc)
{
......
......@@ -57,6 +57,7 @@
* Added VRT_ValidHdr()
* struct vmod_priv_methods added
* struct vmod_priv free member replaced with methods
* VRT_CTX_Assert() added
* 12.0 (2020-09-15)
* Added VRT_DirectorResolve()
* Added VCL_STRING VRT_BLOB_string(VRT_CTX, VCL_BLOB)
......@@ -638,6 +639,8 @@ void VRT_VSC_Hide(const struct vsc_seg *);
void VRT_VSC_Reveal(const struct vsc_seg *);
size_t VRT_VSC_Overhead(size_t);
void VRT_CTX_Assert(VRT_CTX);
/*
* API to restrict the VCL in various ways
*/
......
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