conns_by_ctx.emplace(ctx, conn);
}
- ~redis_pool() {
- /*
- * XXX: this will prevent hiredis to unregister connections that
- * are already destroyed during redisAsyncFree...
- */
+ /* Hack to prevent Redis callbacks to be executed */
+ auto prepare_to_die() -> void
+ {
wanna_die = true;
}
+
+ ~redis_pool() {}
};
{
auto *pool = reinterpret_cast<class rspamd::redis_pool *>(p);
+ pool->prepare_to_die();
delete pool;
}
extern int luaopen_bit(lua_State *L);
#endif
+static bool lua_initialized = false;
+
lua_State *
rspamd_lua_init (bool wipe_mem)
{
lua_setglobal (L, "get_traces");
#endif
+ lua_initialized = true;
+
return L;
}
DL_DELETE(rspamd_lua_global_ctx, ctx);
kh_destroy(lua_class_set, ctx->classes);
g_free(ctx);
+
+ lua_initialized = false;
+}
+
+bool
+rspamd_lua_is_initialised(void)
+{
+ return lua_initialized;
}
void
bool rspamd_lua_universal_pcall (lua_State *L, gint cbref, const gchar* strloc,
gint nret, const gchar *args, GError **err, ...);
+/**
+ * Returns true if lua is initialised
+ * @return
+ */
+bool rspamd_lua_is_initialised(void);
+
/**
* Wrapper for lua_geti from lua 5.3
* @param L
ctx = sp_ud->ctx;
ud = sp_ud->c;
- if (ud->terminated) {
+ if (ud->terminated || !rspamd_lua_is_initialised()) {
/* We are already at the termination stage, just go out */
return;
}