mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Provide send_timeout_close option in TCP only in R13B or higher (EJAB-926)
SVN Revision: 2682
This commit is contained in:
parent
372658d299
commit
0095f4fbf9
@ -127,15 +127,18 @@ init_udp(PortIP, Module, Opts, SockOpts, Port, IPS) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
init_tcp(PortIP, Module, Opts, SockOpts, Port, IPS) ->
|
init_tcp(PortIP, Module, Opts, SockOpts, Port, IPS) ->
|
||||||
|
SockOpts2 = case erlang:system_info(otp_release) >= "R13B" of
|
||||||
|
true -> [{send_timeout_close, true} | SockOpts];
|
||||||
|
false -> []
|
||||||
|
end,
|
||||||
Res = gen_tcp:listen(Port, [binary,
|
Res = gen_tcp:listen(Port, [binary,
|
||||||
{packet, 0},
|
{packet, 0},
|
||||||
{active, false},
|
{active, false},
|
||||||
{reuseaddr, true},
|
{reuseaddr, true},
|
||||||
{nodelay, true},
|
{nodelay, true},
|
||||||
{send_timeout, ?TCP_SEND_TIMEOUT},
|
{send_timeout, ?TCP_SEND_TIMEOUT},
|
||||||
{send_timeout_close, true},
|
|
||||||
{keepalive, true} |
|
{keepalive, true} |
|
||||||
SockOpts]),
|
SockOpts2]),
|
||||||
case Res of
|
case Res of
|
||||||
{ok, ListenSocket} ->
|
{ok, ListenSocket} ->
|
||||||
%% Inform my parent that this port was opened succesfully
|
%% Inform my parent that this port was opened succesfully
|
||||||
|
@ -257,11 +257,15 @@ open_socket1(Host, Port) ->
|
|||||||
open_socket2(Type, Addr, Port) ->
|
open_socket2(Type, Addr, Port) ->
|
||||||
?DEBUG("s2s_out: connecting to ~p:~p~n", [Addr, Port]),
|
?DEBUG("s2s_out: connecting to ~p:~p~n", [Addr, Port]),
|
||||||
Timeout = outgoing_s2s_timeout(),
|
Timeout = outgoing_s2s_timeout(),
|
||||||
|
SockOpts = case erlang:system_info(otp_release) >= "R13B" of
|
||||||
|
true -> [{send_timeout_close, true}];
|
||||||
|
false -> []
|
||||||
|
end,
|
||||||
case (catch ejabberd_socket:connect(Addr, Port,
|
case (catch ejabberd_socket:connect(Addr, Port,
|
||||||
[binary, {packet, 0},
|
[binary, {packet, 0},
|
||||||
{send_timeout, ?TCP_SEND_TIMEOUT},
|
{send_timeout, ?TCP_SEND_TIMEOUT},
|
||||||
{send_timeout_close, true},
|
{send_timeout_close, true},
|
||||||
{active, false}, Type],
|
{active, false}, Type | SockOpts],
|
||||||
Timeout)) of
|
Timeout)) of
|
||||||
{ok, _Socket} = R -> R;
|
{ok, _Socket} = R -> R;
|
||||||
{error, Reason} = R ->
|
{error, Reason} = R ->
|
||||||
|
Loading…
Reference in New Issue
Block a user