diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-12 14:44:35 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-12 14:44:35 +0000 |
commit | 85b3f42f215e5736d90a803835f506673538bbd0 (patch) | |
tree | 30ac8621fee86ad9dcb5f7950af157016e0bc3cf /src/libserver/worker_util.c | |
parent | d54124d738a0e30d2b3b9adb1966374935ff3f46 (diff) | |
download | rspamd-85b3f42f215e5736d90a803835f506673538bbd0.tar.gz rspamd-85b3f42f215e5736d90a803835f506673538bbd0.zip |
Initial support for dynamic modules and workers
Diffstat (limited to 'src/libserver/worker_util.c')
-rw-r--r-- | src/libserver/worker_util.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index 8bda8d709..b18c36ec9 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -49,14 +49,31 @@ worker_t * rspamd_get_worker_by_type (struct rspamd_config *cfg, GQuark type) { - worker_t **cur; + worker_t **pwrk, *wrk; + GList *cur; - cur = cfg->compiled_workers; - while (cur && *cur) { - if (g_quark_from_string ((*cur)->name) == type) { - return *cur; + pwrk = cfg->compiled_workers; + while (pwrk && *pwrk) { + if (rspamd_check_worker (cfg, *pwrk)) { + if (g_quark_from_string ((*pwrk)->name) == type) { + return *pwrk; + } } - cur++; + + pwrk++; + } + + cur = g_list_first (cfg->dynamic_workers); + while (cur) { + wrk = cur->data; + + if (rspamd_check_worker (cfg, wrk)) { + if (g_quark_from_string (wrk->name) == type) { + return wrk; + } + } + + cur = g_list_next (cur); } return NULL; |