* src/ejabberd_s2s_out.erl: Bugfix

SVN Revision: 700
This commit is contained in:
Alexey Shchepin 2006-12-31 00:38:11 +00:00
parent c2f3d4f9a6
commit 56f01cfe6e
2 changed files with 27 additions and 23 deletions

View File

@ -1,3 +1,7 @@
2006-12-31 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_s2s_out.erl: Bugfix
2006-12-21 Mickael Remond <mickael.remond@process-one.net>
* src/mod_private_odbc: Bugfix: an internal error was returned

View File

@ -141,7 +141,11 @@ init([From, Server, Type]) ->
%% {stop, Reason, NewStateData}
%%----------------------------------------------------------------------
open_socket(init, StateData) ->
AddrList = get_addr_port(StateData#state.server),
AddrList = case idna:domain_utf8_to_ascii(StateData#state.server) of
false -> [];
ASCIIAddr ->
get_addr_port(ASCIIAddr)
end,
case lists:foldl(fun({Addr, Port}, Acc) ->
case Acc of
{ok, Socket} ->
@ -174,28 +178,24 @@ open_socket(_, StateData) ->
%%----------------------------------------------------------------------
open_socket1(Addr, Port) ->
Res = case idna:domain_utf8_to_ascii(Addr) of
false -> {error, badarg};
ASCIIAddr ->
?DEBUG("s2s_out: connecting to ~s:~p~n", [ASCIIAddr, Port]),
case catch ejabberd_socket:connect(
ASCIIAddr, Port,
[binary, {packet, 0},
{active, false}]) of
{ok, _Socket} = R -> R;
{error, Reason1} ->
?DEBUG("s2s_out: connect return ~p~n", [Reason1]),
catch ejabberd_socket:connect(
Addr, Port,
[binary, {packet, 0},
{active, false}, inet6]);
{'EXIT', Reason1} ->
?DEBUG("s2s_out: connect crashed ~p~n", [Reason1]),
catch ejabberd_socket:connect(
Addr, Port,
[binary, {packet, 0},
{active, false}, inet6])
end
?DEBUG("s2s_out: connecting to ~s:~p~n", [Addr, Port]),
Res = case catch ejabberd_socket:connect(
Addr, Port,
[binary, {packet, 0},
{active, false}]) of
{ok, _Socket} = R -> R;
{error, Reason1} ->
?DEBUG("s2s_out: connect return ~p~n", [Reason1]),
catch ejabberd_socket:connect(
Addr, Port,
[binary, {packet, 0},
{active, false}, inet6]);
{'EXIT', Reason1} ->
?DEBUG("s2s_out: connect crashed ~p~n", [Reason1]),
catch ejabberd_socket:connect(
Addr, Port,
[binary, {packet, 0},
{active, false}, inet6])
end,
case Res of
{ok, Socket} ->