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

* src/ejabberd_s2s_out.erl: Fixed behavior when outgoing_s2s_port

option is not defined

SVN Revision: 1129
This commit is contained in:
Alexey Shchepin 2007-12-29 14:22:38 +00:00
parent f3aa8a03d3
commit e0fc360cf8
2 changed files with 15 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2007-12-29 Alexey Shchepin <alexey@process-one.net>
* src/ejabberd_s2s_out.erl: Fixed behavior when outgoing_s2s_port
option is not defined
2007-12-27 Badlop <badlop@process-one.net> 2007-12-27 Badlop <badlop@process-one.net>
* src/mod_vcard_ldap.erl: Fix some field names (EJAB-483) * src/mod_vcard_ldap.erl: Fix some field names (EJAB-483)

View File

@ -923,14 +923,13 @@ get_addr_port(Server) ->
case Res of case Res of
{error, Reason} -> {error, Reason} ->
?DEBUG("srv lookup of '~s' failed: ~p~n", [Server, Reason]), ?DEBUG("srv lookup of '~s' failed: ~p~n", [Server, Reason]),
[{Server, ejabberd_config:get_local_option(outgoing_s2s_port)}]; [{Server, outgoing_s2s_port()}];
{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 case HEnt#hostent.h_addr_list of
[] -> [] ->
[{Server, [{Server, outgoing_s2s_port()}];
ejabberd_config:get_local_option(outgoing_s2s_port)}];
AddrList -> 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)
@ -945,8 +944,7 @@ get_addr_port(Server) ->
{Priority * 65536 - N, Host, Port} {Priority * 65536 - N, Host, Port}
end, AddrList)) of end, AddrList)) of
{'EXIT', _Reasn} -> {'EXIT', _Reasn} ->
[{Server, [{Server, outgoing_s2s_port()}];
ejabberd_config:get_local_option(outgoing_s2s_port)}];
SortedList -> SortedList ->
List = lists:map( List = lists:map(
fun({_, Host, Port}) -> fun({_, Host, Port}) ->
@ -970,6 +968,13 @@ test_get_addr_port(Server) ->
end end
end, [], lists:seq(1, 100000)). end, [], lists:seq(1, 100000)).
outgoing_s2s_port() ->
case ejabberd_config:get_local_option(outgoing_s2s_port) of
Port when is_integer(Port) ->
Port;
undefined ->
5269
end.
%% Human readable S2S logging: Log only new outgoing connections as INFO %% Human readable S2S logging: Log only new outgoing connections as INFO
%% Do not log dialback %% Do not log dialback