From ebd0356dafb1774006dcbff911b0e8293ccaa9d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Vavru=C5=A1a?= Date: Sun, 21 Jun 2015 11:48:38 +0200 Subject: [PATCH] daemon/ffi: skip layer calls in invalid states --- daemon/ffimodule.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daemon/ffimodule.c b/daemon/ffimodule.c index c920ffb22..e056d54e0 100644 --- a/daemon/ffimodule.c +++ b/daemon/ffimodule.c @@ -165,6 +165,9 @@ static int l_ffi_layer_finish(knot_layer_t *ctx) static int l_ffi_layer_consume(knot_layer_t *ctx, knot_pkt_t *pkt) { + if (ctx->state & KNOT_STATE_FAIL) { + return ctx->state; /* Already failed, skip */ + } LAYER_FFI_CALL(ctx, "consume"); lua_pushlightuserdata(L, ctx->data); lua_pushlightuserdata(L, pkt); @@ -174,6 +177,9 @@ static int l_ffi_layer_consume(knot_layer_t *ctx, knot_pkt_t *pkt) static int l_ffi_layer_produce(knot_layer_t *ctx, knot_pkt_t *pkt) { + if (ctx->state & (KNOT_STATE_FAIL|KNOT_STATE_DONE)) { + return ctx->state; /* Already resolved/failed, skip */ + } LAYER_FFI_CALL(ctx, "produce"); lua_pushlightuserdata(L, ctx->data); lua_pushlightuserdata(L, pkt); -- 2.47.2