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

Improve handle of inet:gethostbyname return

This commit is contained in:
Badlop 2010-06-18 11:52:36 +02:00
parent be111b6749
commit 19a8b79342

View File

@ -1018,10 +1018,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(),
@ -1043,7 +1040,6 @@ get_addr_port(Server) ->
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
end end
end. end.