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

Apply cosmetic changes to outgoing s2s IP options

This commit is contained in:
Holger Weiss 2020-11-04 13:12:06 +01:00
parent 0a88f9c8a9
commit 23a18b1a60
2 changed files with 13 additions and 11 deletions

View File

@ -90,8 +90,8 @@
-export([oom_killer/0]). -export([oom_killer/0]).
-export([oom_queue/0]). -export([oom_queue/0]).
-export([oom_watermark/0]). -export([oom_watermark/0]).
-export([outgoing_s2s_ipv4_address/0,outgoing_s2s_ipv4_address/1]). -export([outgoing_s2s_ipv4_address/0, outgoing_s2s_ipv4_address/1]).
-export([outgoing_s2s_ipv6_address/0,outgoing_s2s_ipv6_address/1]). -export([outgoing_s2s_ipv6_address/0, outgoing_s2s_ipv6_address/1]).
-export([outgoing_s2s_families/0, outgoing_s2s_families/1]). -export([outgoing_s2s_families/0, outgoing_s2s_families/1]).
-export([outgoing_s2s_port/0, outgoing_s2s_port/1]). -export([outgoing_s2s_port/0, outgoing_s2s_port/1]).
-export([outgoing_s2s_timeout/0, outgoing_s2s_timeout/1]). -export([outgoing_s2s_timeout/0, outgoing_s2s_timeout/1]).

View File

@ -188,14 +188,17 @@ tls_enabled(#{server_host := ServerHost}) ->
ejabberd_s2s:tls_enabled(ServerHost). ejabberd_s2s:tls_enabled(ServerHost).
connect_options(Addr, Opts, #{server_host := ServerHost}) -> connect_options(Addr, Opts, #{server_host := ServerHost}) ->
Type = get_addr_type(Addr), BindAddr = case get_addr_type(Addr) of
Bindaddr = case Type of inet ->
inet -> ejabberd_option:outgoing_s2s_ipv4_address(ServerHost); ejabberd_option:outgoing_s2s_ipv4_address(ServerHost);
inet6 -> ejabberd_option:outgoing_s2s_ipv6_address(ServerHost) inet6 ->
end, ejabberd_option:outgoing_s2s_ipv6_address(ServerHost)
case Bindaddr of end,
undefined -> Opts; case BindAddr of
_ -> lists:append([Opts, [{ip, Bindaddr}]]) undefined ->
Opts;
_ ->
[{ip, BindAddr} | Opts]
end. end.
connect_timeout(#{server_host := ServerHost}) -> connect_timeout(#{server_host := ServerHost}) ->
@ -329,7 +332,6 @@ code_change(_OldVsn, State, _Extra) ->
%%%=================================================================== %%%===================================================================
%%% Internal functions %%% Internal functions
%%%=================================================================== %%%===================================================================
-spec get_addr_type(inet:ip_address()) -> inet:address_family(). -spec get_addr_type(inet:ip_address()) -> inet:address_family().
get_addr_type({_, _, _, _}) -> inet; get_addr_type({_, _, _, _}) -> inet;
get_addr_type({_, _, _, _, _, _, _, _}) -> inet6. get_addr_type({_, _, _, _, _, _, _, _}) -> inet6.