aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-29 15:40:05 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-29 15:40:05 +0000
commit08d2fa41695932bfaf199362a0dac27002ffa922 (patch)
tree3a5b4809b63956806870e705548c38831ffa8332 /src/main.c
parentebb8d1787fe6fdf0afb9cc74be10714485d869d1 (diff)
downloadrspamd-08d2fa41695932bfaf199362a0dac27002ffa922.tar.gz
rspamd-08d2fa41695932bfaf199362a0dac27002ffa922.zip
Fuck ipv6 inventors for ipv6/v4 sockets.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index e5e2112c6..7f7d82725 100644
--- a/src/main.c
+++ b/src/main.c
@@ -560,6 +560,15 @@ delay_fork (struct rspamd_worker_conf *cf)
set_alarm (SOFT_FORK_TIME);
}
+static int
+af_cmp_workaround (const void *a, const void *b)
+{
+ rspamd_inet_addr_t *a1 = (rspamd_inet_addr_t *)a,
+ *a2 = (rspamd_inet_addr_t *)b;
+
+ return a2->af - a1->af;
+}
+
static GList *
create_listen_socket (rspamd_inet_addr_t *addrs, guint cnt, gint listen_type)
{
@@ -567,6 +576,8 @@ create_listen_socket (rspamd_inet_addr_t *addrs, guint cnt, gint listen_type)
gint fd;
guint i;
+ /* Fuck morons that have invented ipv6/v4 sockets */
+ qsort (addrs, cnt, sizeof (*addrs), af_cmp_workaround);
for (i = 0; i < cnt; i ++) {
fd = rspamd_inet_address_listen (&addrs[i], listen_type, TRUE);
if (fd != -1) {
@@ -675,8 +686,7 @@ spawn_workers (struct rspamd_main *rspamd)
}
else {
if (cf->worker->has_socket) {
- LL_FOREACH (cf->bind_conf, bcf)
- {
+ LL_FOREACH (cf->bind_conf, bcf) {
key = make_listen_key (bcf);
if ((p =
g_hash_table_lookup (listen_sockets,