diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-09-16 00:48:38 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-09-16 00:48:38 +0100 |
commit | 85a1704ee40b0518c5e4d4eabccc6b4a387e2480 (patch) | |
tree | 1cd46e3613c88d939ec4dc058e887ce48c2b0e54 /src/main.c | |
parent | 2fa167601ae2194bbdf4484fe2ad8e3eee813163 (diff) | |
download | rspamd-85a1704ee40b0518c5e4d4eabccc6b4a387e2480.tar.gz rspamd-85a1704ee40b0518c5e4d4eabccc6b4a387e2480.zip |
Allow multiply bind configurations.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/main.c b/src/main.c index cab81c10e..6b593f638 100644 --- a/src/main.c +++ b/src/main.c @@ -612,6 +612,7 @@ spawn_workers (struct rspamd_main *rspamd) struct worker_conf *cf; gint i; gpointer p; + struct rspamd_worker_bind_conf *bcf; cur = rspamd->cfg->workers; @@ -623,23 +624,26 @@ spawn_workers (struct rspamd_main *rspamd) } else { if (cf->worker->has_socket) { - if ((p = g_hash_table_lookup (listen_sockets, GINT_TO_POINTER ( - make_listen_key (cf->bind_addr, cf->bind_port, cf->bind_family)))) == NULL) { - /* Create listen socket */ - ls = create_listen_socket (cf->bind_addr, cf->bind_port, cf->bind_family, - cf->worker->listen_type); - if (ls == NULL) { - exit (-errno); + LL_FOREACH (cf->bind_conf, bcf) { + if ((p = g_hash_table_lookup (listen_sockets, GINT_TO_POINTER ( + make_listen_key (bcf->bind_host, bcf->bind_port, bcf->is_unix)))) == NULL) { + /* Create listen socket */ + ls = create_listen_socket (bcf->bind_host, bcf->bind_port, + bcf->is_unix ? AF_UNIX : AF_INET, + cf->worker->listen_type); + if (ls == NULL) { + exit (-errno); + } + g_hash_table_insert (listen_sockets, GINT_TO_POINTER ( + make_listen_key (bcf->bind_host, bcf->bind_port, bcf->is_unix)), + ls); } - g_hash_table_insert (listen_sockets, GINT_TO_POINTER ( - make_listen_key (cf->bind_addr, cf->bind_port, cf->bind_family)), - ls); - } - else { - /* We had socket for this type of worker */ - ls = p; + else { + /* We had socket for this type of worker */ + ls = p; + } + cf->listen_socks = g_list_prepend (cf->listen_socks, ls); } - cf->listen_socks = ls; } if (cf->worker->unique) { |