Commit 478bdeb9 by Nils Goroll

Use VRT_fail to fail from housekeeping subs (vcl_init/vcl_fini)

parent c8358237
......@@ -35,11 +35,21 @@
#include "vas.h"
#include "vcc_if.h"
#define ERR(ctx, msg) \
errmsg((ctx), "vmod hoailona error: " msg)
#define VERR(ctx, fmt, ...) \
errmsg((ctx), "vmod hoailona error: " fmt, __VA_ARGS__)
#define epfx "vmod hoailona error: "
#define ERR(ctx, msg) do { \
if (ctx->method & VCL_MET_TASK_H) \
VRT_fail(ctx, epfx msg); \
else \
VSLb(ctx->vsl, SLT_VCL_Error, epfx msg); \
} while(0)
#define VERR(ctx, fmt, ...) do { \
if (ctx->method & VCL_MET_TASK_H) \
VRT_fail(ctx, epfx fmt, __VA_ARGS__); \
else \
VSLb(ctx->vsl, SLT_VCL_Error, epfx fmt, __VA_ARGS__); \
} while(0)
#define VERRNOMEM(ctx, fmt, ...) \
VERR((ctx), fmt ", out of space", __VA_ARGS__)
......@@ -98,27 +108,6 @@ get_policy(VRT_CTX, const struct vmod_priv * restrict const,
const char * restrict const,
const char * restrict const);
void
errmsg(VRT_CTX, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
if (ctx->vsl)
VSLbv(ctx->vsl, SLT_VCL_Error, fmt, args);
else
VSLv(SLT_VCL_Error, 0, fmt, args);
va_end(args);
if (ctx->method == VCL_MET_INIT) {
AN(ctx->msg);
va_start(args, fmt);
VSB_vprintf(ctx->msg, fmt, args);
va_end(args);
VRT_handling(ctx, VCL_RET_FAIL);
}
}
/* Event function */
int v_matchproto_(vmod_event_f)
......
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