diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-23 11:11:52 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-23 11:11:52 +0000 |
commit | a022d264bb0838e7ff170f3165e169a81baab3d9 (patch) | |
tree | e86662d661d18c8b8da6a52ef2d95e49f4bf6dc0 /src/libutil/upstream.c | |
parent | ef9d816e983d6559e6c711a2a5e2e76a2ddbd226 (diff) | |
download | rspamd-a022d264bb0838e7ff170f3165e169a81baab3d9.tar.gz rspamd-a022d264bb0838e7ff170f3165e169a81baab3d9.zip |
Use xxh64 for upstreams hashing.
Diffstat (limited to 'src/libutil/upstream.c')
-rw-r--r-- | src/libutil/upstream.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index 36aa94c61..61f40d419 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -634,19 +634,14 @@ rspamd_consistent_hash (guint64 key, guint32 nbuckets) static struct upstream* rspamd_upstream_get_hashed (struct upstream_list *ups, const guint8 *key, guint keylen) { - union { - guint64 k64; - guint32 k32[2]; - } h; - + guint64 k; guint32 idx; /* Generate 64 bits input key */ - h.k32[0] = XXH32 (key, keylen, ((guint32*)&ups->hash_seed)[0]); - h.k32[1] = XXH32 (key, keylen, ((guint32*)&ups->hash_seed)[1]); + k = XXH64 (key, keylen, ups->hash_seed); rspamd_mutex_lock (ups->lock); - idx = rspamd_consistent_hash (h.k64, ups->alive->len); + idx = rspamd_consistent_hash (k, ups->alive->len); rspamd_mutex_unlock (ups->lock); return g_ptr_array_index (ups->alive, idx); |