From 210060b8d557b2a46236387c67f5e9f426873053 Mon Sep 17 00:00:00 2001 From: Karel Slany <karel.slany@nic.cz> Date: Sun, 31 Jul 2016 12:25:25 +0200 Subject: [PATCH] Added checks for FAIL and DONE when calling cookie module functions. --- modules/cookies/cookiemonster.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/cookies/cookiemonster.c b/modules/cookies/cookiemonster.c index 3b2e3be79..acb37f9c1 100644 --- a/modules/cookies/cookiemonster.c +++ b/modules/cookies/cookiemonster.c @@ -222,6 +222,10 @@ int check_response(knot_layer_t *ctx, knot_pkt_t *pkt) struct kr_query *qry = req->current_query; struct kr_cookie_ctx *cookie_ctx = &req->ctx->cookie_ctx; + if (ctx->state & (KNOT_STATE_DONE | KNOT_STATE_FAIL)) { + return ctx->state; + } + if (!cookie_ctx->clnt.enabled || (qry->flags & QUERY_TCP)) { return ctx->state; } @@ -341,6 +345,10 @@ int check_request(knot_layer_t *ctx, void *module_param) knot_pkt_t *answer = req->answer; + if (ctx->state & (KNOT_STATE_DONE | KNOT_STATE_FAIL)) { + return ctx->state; + } + if (!srvr_sett->enabled) { /* TODO -- IS there a way how to determine whether the original * request came via TCP? */ -- GitLab