From 587d0df0c0d8870fd56cea70663cebbb2b5fb074 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 11 Feb 2015 22:13:02 +0000 Subject: Allow to specify keypairs cache externally. --- src/controller.c | 7 +++++-- src/libutil/http.c | 6 +++--- src/libutil/http.h | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/controller.c b/src/controller.c index a8dbdec96..a0677f49e 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1589,7 +1589,7 @@ start_controller_worker (struct rspamd_worker *worker) struct module_ctx *mctx; GHashTableIter iter; gpointer key, value; - + struct rspamd_keypair_cache *cache; ctx->ev_base = rspamd_prepare_worker (worker, "controller", @@ -1614,9 +1614,10 @@ start_controller_worker (struct rspamd_worker *worker) } } /* Accept event */ + cache = rspamd_keypair_cache_new (256); ctx->http = rspamd_http_router_new (rspamd_controller_error_handler, rspamd_controller_finish_handler, &ctx->io_tv, ctx->ev_base, - ctx->static_files_dir); + ctx->static_files_dir, cache); /* Add callbacks for different methods */ rspamd_http_router_add_path (ctx->http, @@ -1706,6 +1707,8 @@ start_controller_worker (struct rspamd_worker *worker) event_base_loop (ctx->ev_base, 0); g_mime_shutdown (); + rspamd_http_router_free (ctx->http); + rspamd_keypair_cache_destroy (cache); rspamd_log_close (rspamd_main->logger); exit (EXIT_SUCCESS); } diff --git a/src/libutil/http.c b/src/libutil/http.c index 2f948f452..cafcbf6ea 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -1600,7 +1600,8 @@ struct rspamd_http_connection_router * rspamd_http_router_new (rspamd_http_router_error_handler_t eh, rspamd_http_router_finish_handler_t fh, struct timeval *timeout, struct event_base *base, - const char *default_fs_path) + const char *default_fs_path, + struct rspamd_keypair_cache *cache) { struct rspamd_http_connection_router * new; struct stat st; @@ -1635,8 +1636,7 @@ rspamd_http_router_new (rspamd_http_router_error_handler_t eh, } } - /* XXX: stupid default value, should be configurable */ - new->cache = rspamd_keypair_cache_new (256); + new->cache = cache; return new; } diff --git a/src/libutil/http.h b/src/libutil/http.h index 1c79fb45c..c581cb6f6 100644 --- a/src/libutil/http.h +++ b/src/libutil/http.h @@ -333,7 +333,8 @@ struct rspamd_http_connection_router * rspamd_http_router_new ( rspamd_http_router_finish_handler_t fh, struct timeval *timeout, struct event_base *base, - const char *default_fs_path); + const char *default_fs_path, + struct rspamd_keypair_cache *cache); /** * Set encryption key for the HTTP router -- cgit v1.2.3