fix: handshake_timeout is ranch option not socket options
This commit is contained in:
parent
974380a3d4
commit
204f04be65
|
@ -175,34 +175,21 @@ init_i18n() ->
|
||||||
Lang = emqx_conf:get([dashboard, i18n_lang], en),
|
Lang = emqx_conf:get([dashboard, i18n_lang], en),
|
||||||
init_i18n(File, Lang).
|
init_i18n(File, Lang).
|
||||||
|
|
||||||
ranch_opts(RanchOptions) ->
|
ranch_opts(Options) ->
|
||||||
Keys = [
|
Keys = [
|
||||||
{ack_timeout, handshake_timeout},
|
handshake_timeout,
|
||||||
connection_type,
|
connection_type,
|
||||||
max_connections,
|
max_connections,
|
||||||
num_acceptors,
|
num_acceptors,
|
||||||
shutdown,
|
shutdown,
|
||||||
socket
|
socket
|
||||||
],
|
],
|
||||||
{S, R} = lists:foldl(fun key_take/2, {RanchOptions, #{}}, Keys),
|
RanchOpts = maps:with(Keys, Options),
|
||||||
R#{socket_opts => maps:fold(fun key_only/3, [], S)}.
|
SocketOpts = maps:fold(fun filter_false/3, [], maps:without([enable | Keys], Options)),
|
||||||
|
RanchOpts#{socket_opts => SocketOpts}.
|
||||||
|
|
||||||
key_take(Key, {All, R}) ->
|
filter_false(_K, false, S) -> S;
|
||||||
{K, KX} =
|
filter_false(K, V, S) -> [{K, V} | S].
|
||||||
case Key of
|
|
||||||
{K1, K2} -> {K1, K2};
|
|
||||||
_ -> {Key, Key}
|
|
||||||
end,
|
|
||||||
case maps:get(K, All, undefined) of
|
|
||||||
undefined ->
|
|
||||||
{All, R};
|
|
||||||
V ->
|
|
||||||
{maps:remove(K, All), R#{KX => V}}
|
|
||||||
end.
|
|
||||||
|
|
||||||
key_only(K, true, S) -> [K | S];
|
|
||||||
key_only(_K, false, S) -> S;
|
|
||||||
key_only(K, V, S) -> [{K, V} | S].
|
|
||||||
|
|
||||||
listener_name(Protocol, #{port := Port, ip := IP}) ->
|
listener_name(Protocol, #{port := Port, ip := IP}) ->
|
||||||
Name =
|
Name =
|
||||||
|
|
Loading…
Reference in New Issue