From: Vsevolod Stakhov Date: Mon, 3 Nov 2014 10:23:32 +0000 (+0000) Subject: Configure upstreams in workers. X-Git-Tag: 0.7.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15dc327ac96fe547b8bcd7676e76a26fe8c9fd33;p=thirdparty%2Frspamd.git Configure upstreams in workers. --- diff --git a/src/controller.c b/src/controller.c index 98a9df614b..2fb23877e3 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1721,6 +1721,7 @@ start_controller_worker (struct rspamd_worker *worker) worker->srv->cfg); rspamd_upstreams_library_init (ctx->resolver->r, ctx->ev_base); + rspamd_upstreams_library_config (worker->srv->cfg); /* Maps events */ start_map_watch (worker->srv->cfg, ctx->ev_base); diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c index 7e881994ff..2db126d375 100644 --- a/src/smtp_proxy.c +++ b/src/smtp_proxy.c @@ -1073,6 +1073,7 @@ start_smtp_proxy (struct rspamd_worker *worker) worker->srv->cfg); rspamd_upstreams_library_init (ctx->resolver->r, ctx->ev_base); + rspamd_upstreams_library_config (worker->srv->cfg); /* Set umask */ umask (S_IWGRP | S_IWOTH | S_IROTH | S_IRGRP); diff --git a/src/worker.c b/src/worker.c index afd9a9b725..4bca03f2df 100644 --- a/src/worker.c +++ b/src/worker.c @@ -319,6 +319,7 @@ start_worker (struct rspamd_worker *worker) worker->srv->cfg); rspamd_upstreams_library_init (ctx->resolver->r, ctx->ev_base); + rspamd_upstreams_library_config (worker->srv->cfg); /* Create classify pool */ ctx->classify_pool = NULL; diff --git a/test/rspamd_upstream_test.c b/test/rspamd_upstream_test.c index fa81aecd97..16ce27160f 100644 --- a/test/rspamd_upstream_test.c +++ b/test/rspamd_upstream_test.c @@ -61,6 +61,7 @@ rspamd_upstream_test_func (void) struct rspamd_config *cfg; gint i, success = 0; const gint assumptions = 100500; + gdouble p; cfg = (struct rspamd_config *)g_malloc (sizeof (struct rspamd_config)); bzero (cfg, sizeof (struct rspamd_config)); @@ -103,12 +104,13 @@ rspamd_upstream_test_func (void) } } + p = 1.0 - fabs (3.0 / 4.0 - (gdouble)success / (gdouble)assumptions); /* * P value is calculated as following: * when we add/remove M upstreams from the list, the probability of hash * miss should be close to the relation N / (N + M), where N is the size of * the previous upstreams list. */ - msg_info ("p value for hash consistency: %.6f", 1.0 - fabs ((3.0 / 4.0 - - (gdouble)success / (gdouble)assumptions))); + msg_info ("p value for hash consistency: %.6f", p); + g_assert (p > 0.9); }