25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

erlang:phash is deprecated in OTP 24, let's use phash2

This commit is contained in:
Badlop 2021-07-13 23:45:17 +02:00
parent e14cd5dd17
commit e0c9a6308d
2 changed files with 5 additions and 5 deletions

View File

@ -424,15 +424,15 @@ balancing_route(From, To, Packet, Rs) ->
Value = erlang:system_time(), Value = erlang:system_time(),
case [R || R <- Rs, node(R#route.pid) == node()] of 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); do_route(Packet, R);
LRs -> LRs ->
R = lists:nth(erlang:phash(Value, length(LRs)), LRs), R = lists:nth(erlang:phash2(Value, length(LRs))+1, LRs),
do_route(Packet, R) do_route(Packet, R)
end; end;
Value -> Value ->
SRs = lists:ukeysort(#route.local_hint, Rs), 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) do_route(Packet, R)
end. end.

View File

@ -429,8 +429,8 @@ choose_pid(From, Pids) ->
Ps -> Ps Ps -> Ps
end, end,
Pid = Pid =
lists:nth(erlang:phash(jid:remove_resource(From), lists:nth(erlang:phash2(jid:remove_resource(From),
length(Pids1)), length(Pids1))+1,
Pids1), Pids1),
?DEBUG("Using ejabberd_s2s_out ~p~n", [Pid]), ?DEBUG("Using ejabberd_s2s_out ~p~n", [Pid]),
Pid. Pid.