################################ SUBDIRS SECTION ###########################
ADD_SUBDIRECTORY(contrib/hiredis)
-SET(WITH_HIREDIS 1)
INCLUDE_DIRECTORIES(BEFORE "${CMAKE_SOURCE_DIR}/contrib/hiredis")
LIST(APPEND RSPAMD_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
#cmakedefine PARAM_H_HAS_BITSET 1
#cmakedefine WITH_DB 1
#cmakedefine WITH_GPERF_TOOLS 1
-#cmakedefine WITH_HIREDIS 1
#cmakedefine WITH_HYPERSCAN 1
#cmakedefine WITH_JEMALLOC 1
#cmakedefine WITH_LUA 1
cfg->images_cache_size = 256;
cfg->monitored_ctx = rspamd_monitored_ctx_init ();
cfg->neighbours = ucl_object_typed_new (UCL_OBJECT);
-#ifdef WITH_HIREDIS
cfg->redis_pool = rspamd_redis_pool_init ();
-#endif
cfg->default_max_shots = DEFAULT_MAX_SHOTS;
cfg->max_sessions_cache = DEFAULT_MAX_SESSIONS;
cfg->maps_cache_dir = rspamd_mempool_strdup (cfg->cfg_pool, RSPAMD_DBDIR);
lua_close (cfg->lua_state);
}
-#ifdef WITH_HIREDIS
if (cfg->redis_pool) {
rspamd_redis_pool_destroy (cfg->redis_pool);
}
-#endif
rspamd_upstreams_library_unref (cfg->ups_ctx);
HASH_CLEAR (hh, cfg->actions);
.periodic = rspamd_fuzzy_backend_expire_sqlite,
.close = rspamd_fuzzy_backend_close_sqlite,
},
-#ifdef WITH_HIREDIS
[RSPAMD_FUZZY_BACKEND_REDIS] = {
.init = rspamd_fuzzy_backend_init_redis,
.check = rspamd_fuzzy_backend_check_redis,
.periodic = rspamd_fuzzy_backend_expire_redis,
.close = rspamd_fuzzy_backend_close_redis,
}
-#endif
};
struct rspamd_fuzzy_backend {
rspamd_worker_init_signals (worker, event_loop);
rspamd_control_worker_add_default_cmd_handlers (worker, event_loop);
rspamd_worker_heartbeat_start (worker, event_loop);
-#ifdef WITH_HIREDIS
rspamd_redis_pool_config (worker->srv->cfg->redis_pool,
worker->srv->cfg, event_loop);
-#endif
/* Accept all sockets */
if (hdl) {
RSPAMD_STAT_BACKEND_DEF(mmaped_file);
RSPAMD_STAT_BACKEND_DEF(sqlite3);
RSPAMD_STAT_BACKEND_DEF(cdb);
-
-#ifdef WITH_HIREDIS
-
RSPAMD_STAT_BACKEND_DEF(redis);
-#endif
-
#ifdef __cplusplus
}
#endif
#include "upstream.h"
#include "lua/lua_common.h"
#include "libserver/mempool_vars_internal.h"
-
-#ifdef WITH_HIREDIS
#include "hiredis.h"
#include "adapters/libev.h"
#include "ref.h"
{
return NULL;
}
-
-#endif
void rspamd_stat_cache_##name##_close (gpointer ctx)
RSPAMD_STAT_CACHE_DEF(sqlite3);
-
-#ifdef WITH_HIREDIS
-
RSPAMD_STAT_CACHE_DEF(redis);
-#endif
-
#ifdef __cplusplus
}
#endif
RSPAMD_STAT_BACKEND_ELT(mmap, mmaped_file),
RSPAMD_STAT_BACKEND_ELT(sqlite3, sqlite3),
RSPAMD_STAT_BACKEND_ELT_READONLY(cdb, cdb),
-#ifdef WITH_HIREDIS
RSPAMD_STAT_BACKEND_ELT(redis, redis)
-#endif
};
#define RSPAMD_STAT_CACHE_ELT(nam, eltn) { \
static struct rspamd_stat_cache stat_caches[] = {
RSPAMD_STAT_CACHE_ELT(sqlite3, sqlite3),
-#ifdef WITH_HIREDIS
RSPAMD_STAT_CACHE_ELT(redis, redis),
-#endif
};
void
#define REDIS_RELEASE REF_RELEASE
#endif
-#ifdef WITH_HIREDIS
struct lua_redis_request_specific_userdata;
/**
* Struct for userdata representation
}
}
}
-#else
-static int
-lua_redis_make_request (lua_State *L)
-{
- msg_warn ("rspamd is compiled with no redis support");
-
- lua_pushboolean (L, FALSE);
-
- return 1;
-}
-static int
-lua_redis_make_request_sync (lua_State *L)
-{
- msg_warn ("rspamd is compiled with no redis support");
-
- lua_pushboolean (L, FALSE);
-
- return 1;
-}
-static int
-lua_redis_connect (lua_State *L)
-{
- msg_warn ("rspamd is compiled with no redis support");
-
- lua_pushboolean (L, FALSE);
-
- return 1;
-}
-static int
-lua_redis_connect_sync (lua_State *L)
-{
- msg_warn ("rspamd is compiled with no redis support");
-
- lua_pushboolean (L, FALSE);
-
- return 1;
-}
-static int
-lua_redis_add_cmd (lua_State *L)
-{
- msg_warn ("rspamd is compiled with no redis support");
-
- lua_pushboolean (L, FALSE);
-
- return 1;
-}
-static int
-lua_redis_exec (lua_State *L)
-{
- msg_warn ("rspamd is compiled with no redis support");
-
- lua_pushboolean (L, FALSE);
-
- return 1;
-}
-static int
-lua_redis_gc (lua_State *L)
-{
- return 0;
-}
-#endif
static gint
lua_load_redis (lua_State * L)
rspamd_lua_set_globals (cfg, L);
rspamadm_add_lua_globals (resolver);
-
-#ifdef WITH_HIREDIS
rspamd_redis_pool_config (cfg->redis_pool, cfg, rspamd_main->event_loop);
-#endif
/* Init rspamadm global */
lua_newtable (L);