diff options
author | Vlad Glagolev <vaygr@users.noreply.github.com> | 2016-12-06 22:33:34 -0500 |
---|---|---|
committer | Vlad Glagolev <vaygr@users.noreply.github.com> | 2016-12-06 22:33:34 -0500 |
commit | 1500fff0c91d1e00bea1d2adbbf457193918c4ff (patch) | |
tree | d86293a8afb155f15c71bb6a412eeaa7a3e0a148 /src/libserver | |
parent | 22f8a1e66c19254516453b53fc38c699c673f3f5 (diff) | |
download | rspamd-1500fff0c91d1e00bea1d2adbbf457193918c4ff.tar.gz rspamd-1500fff0c91d1e00bea1d2adbbf457193918c4ff.zip |
made optional dependency on hiredis really optional
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/libserver/cfg_utils.c | 2 | ||||
-rw-r--r-- | src/libserver/fuzzy_backend.c | 6 | ||||
-rw-r--r-- | src/libserver/worker_util.c | 2 |
4 files changed, 13 insertions, 4 deletions
diff --git a/src/libserver/CMakeLists.txt b/src/libserver/CMakeLists.txt index 14f82e482..474e695d1 100644 --- a/src/libserver/CMakeLists.txt +++ b/src/libserver/CMakeLists.txt @@ -8,12 +8,10 @@ SET(LIBRSPAMDSERVERSRC ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_cfg.c ${CMAKE_CURRENT_SOURCE_DIR}/events.c ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend.c - ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend_redis.c ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend_sqlite.c ${CMAKE_CURRENT_SOURCE_DIR}/html.c ${CMAKE_CURRENT_SOURCE_DIR}/monitored.c ${CMAKE_CURRENT_SOURCE_DIR}/protocol.c - ${CMAKE_CURRENT_SOURCE_DIR}/redis_pool.c ${CMAKE_CURRENT_SOURCE_DIR}/re_cache.c ${CMAKE_CURRENT_SOURCE_DIR}/roll_history.c ${CMAKE_CURRENT_SOURCE_DIR}/spf.c @@ -22,5 +20,10 @@ SET(LIBRSPAMDSERVERSRC ${CMAKE_CURRENT_SOURCE_DIR}/url.c ${CMAKE_CURRENT_SOURCE_DIR}/worker_util.c) +IF (ENABLE_HIREDIS MATCHES "ON") + LIST(APPEND LIBRSPAMDSERVERSRC "${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend_redis.c") + LIST(APPEND LIBRSPAMDSERVERSRC "${CMAKE_CURRENT_SOURCE_DIR}/redis_pool.c") +ENDIF () + # Librspamd-server SET(RSPAMD_SERVER ${LIBRSPAMDSERVERSRC} PARENT_SCOPE) diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 24b5568b9..33b438037 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -172,7 +172,9 @@ rspamd_config_new (void) cfg->ssl_ciphers = "HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4"; cfg->max_message = DEFAULT_MAX_MESSAGE; cfg->monitored_ctx = rspamd_monitored_ctx_init (); +#ifdef ENABLE_HIREDIS cfg->redis_pool = rspamd_redis_pool_init (); +#endif REF_INIT_RETAIN (cfg, rspamd_config_free); diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend.c index 3dec60c57..0f89ad196 100644 --- a/src/libserver/fuzzy_backend.c +++ b/src/libserver/fuzzy_backend.c @@ -85,8 +85,9 @@ static const struct rspamd_fuzzy_backend_subr fuzzy_subrs[] = { .id = rspamd_fuzzy_backend_id_sqlite, .periodic = rspamd_fuzzy_backend_expire_sqlite, .close = rspamd_fuzzy_backend_close_sqlite, - }, - [RSPAMD_FUZZY_BACKEND_REDIS] = { + } +#ifdef ENABLE_HIREDIS + ,[RSPAMD_FUZZY_BACKEND_REDIS] = { .init = rspamd_fuzzy_backend_init_redis, .check = rspamd_fuzzy_backend_check_redis, .update = rspamd_fuzzy_backend_update_redis, @@ -96,6 +97,7 @@ static const struct rspamd_fuzzy_backend_subr fuzzy_subrs[] = { .periodic = rspamd_fuzzy_backend_expire_redis, .close = rspamd_fuzzy_backend_close_redis, } +#endif }; struct rspamd_fuzzy_backend { diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index 5d0747a66..0f7c67579 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -289,8 +289,10 @@ rspamd_prepare_worker (struct rspamd_worker *worker, const char *name, rspamd_worker_init_signals (worker, ev_base); rspamd_control_worker_add_default_handler (worker, ev_base); +#ifdef ENABLE_HIREDIS rspamd_redis_pool_config (worker->srv->cfg->redis_pool, worker->srv->cfg, ev_base); +#endif /* Accept all sockets */ if (accept_handler) { |