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:
parent
0a88f9c8a9
commit
23a18b1a60
@ -90,8 +90,8 @@
|
||||
-export([oom_killer/0]).
|
||||
-export([oom_queue/0]).
|
||||
-export([oom_watermark/0]).
|
||||
-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_ipv4_address/0, outgoing_s2s_ipv4_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_port/0, outgoing_s2s_port/1]).
|
||||
-export([outgoing_s2s_timeout/0, outgoing_s2s_timeout/1]).
|
||||
|
@ -188,14 +188,17 @@ tls_enabled(#{server_host := ServerHost}) ->
|
||||
ejabberd_s2s:tls_enabled(ServerHost).
|
||||
|
||||
connect_options(Addr, Opts, #{server_host := ServerHost}) ->
|
||||
Type = get_addr_type(Addr),
|
||||
Bindaddr = case Type of
|
||||
inet -> ejabberd_option:outgoing_s2s_ipv4_address(ServerHost);
|
||||
inet6 -> ejabberd_option:outgoing_s2s_ipv6_address(ServerHost)
|
||||
end,
|
||||
case Bindaddr of
|
||||
undefined -> Opts;
|
||||
_ -> lists:append([Opts, [{ip, Bindaddr}]])
|
||||
BindAddr = case get_addr_type(Addr) of
|
||||
inet ->
|
||||
ejabberd_option:outgoing_s2s_ipv4_address(ServerHost);
|
||||
inet6 ->
|
||||
ejabberd_option:outgoing_s2s_ipv6_address(ServerHost)
|
||||
end,
|
||||
case BindAddr of
|
||||
undefined ->
|
||||
Opts;
|
||||
_ ->
|
||||
[{ip, BindAddr} | Opts]
|
||||
end.
|
||||
|
||||
connect_timeout(#{server_host := ServerHost}) ->
|
||||
@ -329,7 +332,6 @@ code_change(_OldVsn, State, _Extra) ->
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
|
||||
-spec get_addr_type(inet:ip_address()) -> inet:address_family().
|
||||
get_addr_type({_, _, _, _}) -> inet;
|
||||
get_addr_type({_, _, _, _, _, _, _, _}) -> inet6.
|
||||
|
Loading…
Reference in New Issue
Block a user