aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_router.erl
diff options
context:
space:
mode:
authorPouriya <pouriya.jahanbakhsh@gmail.com>2021-09-18 16:09:11 +0430
committerGitHub <noreply@github.com>2021-09-18 16:09:11 +0430
commit3eb795357ff2278fa641608f442c9800d74c9c0a (patch)
tree9592f786ad76e91b442fcf9a83cdd609ede3a9c2 /src/ejabberd_router.erl
parentref: fix WS typos (diff)
parentFix previous commit: add forgotten endline blankspaces (diff)
Merge branch 'processone:master' into master
Diffstat (limited to 'src/ejabberd_router.erl')
-rw-r--r--src/ejabberd_router.erl6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ejabberd_router.erl b/src/ejabberd_router.erl
index 4939ae1e8..492beb6d3 100644
--- a/src/ejabberd_router.erl
+++ b/src/ejabberd_router.erl
@@ -424,15 +424,15 @@ balancing_route(From, To, Packet, Rs) ->
Value = erlang:system_time(),
case [R || R <- Rs, node(R#route.pid) == node()] of
[] ->
- R = lists:nth(erlang:phash(Value, length(Rs)), Rs),
+ R = lists:nth(erlang:phash2(Value, length(Rs))+1, Rs),
do_route(Packet, R);
LRs ->
- R = lists:nth(erlang:phash(Value, length(LRs)), LRs),
+ R = lists:nth(erlang:phash2(Value, length(LRs))+1, LRs),
do_route(Packet, R)
end;
Value ->
SRs = lists:ukeysort(#route.local_hint, Rs),
- R = lists:nth(erlang:phash(Value, length(SRs)), SRs),
+ R = lists:nth(erlang:phash2(Value, length(SRs))+1, SRs),
do_route(Packet, R)
end.