Skip to content
Snippets Groups Projects
Commit ebd0356d authored by Marek Vavruša's avatar Marek Vavruša
Browse files

daemon/ffi: skip layer calls in invalid states

parent b2971833
Branches
Tags
No related merge requests found
......@@ -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);
......
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