26
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-28 17:38:54 +01:00

Reorganize the code to shut up the dialyzer

This commit is contained in:
Evgeniy Khramtsov 2011-09-05 21:27:31 +10:00
parent f3c90ee266
commit 6b0eb1f09d

View File

@ -1073,10 +1073,7 @@ get_addr_port(Server) ->
{ok, HEnt} -> {ok, HEnt} ->
?DEBUG("srv lookup of '~s': ~p~n", ?DEBUG("srv lookup of '~s': ~p~n",
[Server, HEnt#hostent.h_addr_list]), [Server, HEnt#hostent.h_addr_list]),
case HEnt#hostent.h_addr_list of AddrList = HEnt#hostent.h_addr_list,
[] ->
[{Server, outgoing_s2s_port()}];
AddrList ->
%% Probabilities are not exactly proportional to weights %% Probabilities are not exactly proportional to weights
%% for simplicity (higher weigths are overvalued) %% for simplicity (higher weigths are overvalued)
{A1, A2, A3} = now(), {A1, A2, A3} = now(),
@ -1089,16 +1086,15 @@ get_addr_port(Server) ->
end, end,
{Priority * 65536 - N, Host, Port} {Priority * 65536 - N, Host, Port}
end, AddrList)) of end, AddrList)) of
{'EXIT', _Reason} -> SortedList = [_|_] ->
[{Server, outgoing_s2s_port()}];
SortedList ->
List = lists:map( List = lists:map(
fun({_, Host, Port}) -> fun({_, Host, Port}) ->
{Host, Port} {Host, Port}
end, lists:keysort(1, SortedList)), end, lists:keysort(1, SortedList)),
?DEBUG("srv lookup of '~s': ~p~n", [Server, List]), ?DEBUG("srv lookup of '~s': ~p~n", [Server, List]),
List List;
end _ ->
[{Server, outgoing_s2s_port()}]
end end
end. end.