chore: gitignore erlang_ls.config

This commit is contained in:
William Yang 2021-07-20 14:09:13 +02:00 committed by turtleDeng
parent 7521d09079
commit de387c4c8e
3 changed files with 32 additions and 24 deletions

View File

@ -124,7 +124,7 @@ export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60
export EMQX_MQTT__MAX_TOPIC_ALIAS=10 export EMQX_MQTT__MAX_TOPIC_ALIAS=10
EOF EOF
## for ARM, due to CI env issue, skip start of quic listener for the moment ## for ARM, due to CI env issue, skip start of quic listener for the moment
[[ $(arch) == *arm* || $(arch) == aarch64 ]] && tee tee -a "$emqx_env_vars" <<EOF [[ $(arch) == *arm* || $(arch) == aarch64 ]] && tee -a "$emqx_env_vars" <<EOF
export EMQX_ZONES__DEFAULT__LISTENERS__MQTT_QUIC__ENABLED=false export EMQX_ZONES__DEFAULT__LISTENERS__MQTT_QUIC__ENABLED=false
EOF EOF
else else

2
.gitignore vendored
View File

@ -48,3 +48,5 @@ scripts/git-token
apps/*/etc/*.all apps/*/etc/*.all
_upgrade_base/ _upgrade_base/
TAGS TAGS
erlang_ls.config
.els_cache/

View File

@ -45,9 +45,10 @@ start_listener(ListenerId) ->
-spec start_listener(atom(), atom(), map()) -> ok | {error, term()}. -spec start_listener(atom(), atom(), map()) -> ok | {error, term()}.
start_listener(ZoneName, ListenerName, #{type := Type, bind := Bind} = Conf) -> start_listener(ZoneName, ListenerName, #{type := Type, bind := Bind} = Conf) ->
case do_start_listener(ZoneName, ListenerName, Conf) of case do_start_listener(ZoneName, ListenerName, Conf) of
{error, listener_disabled} -> {ok, {skipped, Reason}} when Reason =:= listener_disabled;
console_print("- Skip - starting ~s listener ~s on ~s ~n", Reason =:= quic_app_missing ->
[Type, listener_id(ZoneName, ListenerName), format(Bind)]); console_print("- Skip - starting ~s listener ~s on ~s ~n due to ~p",
[Type, listener_id(ZoneName, ListenerName), format(Bind), Reason]);
{ok, _} -> {ok, _} ->
console_print("Start ~s listener ~s on ~s successfully.~n", console_print("Start ~s listener ~s on ~s successfully.~n",
[Type, listener_id(ZoneName, ListenerName), format(Bind)]); [Type, listener_id(ZoneName, ListenerName), format(Bind)]);
@ -68,7 +69,7 @@ console_print(_Fmt, _Args) -> ok.
-spec(do_start_listener(atom(), atom(), map()) -spec(do_start_listener(atom(), atom(), map())
-> {ok, pid() | {skipped, atom()}} | {error, term()}). -> {ok, pid() | {skipped, atom()}} | {error, term()}).
do_start_listener(_ZoneName, _ListenerName, #{enabled := false}) -> do_start_listener(_ZoneName, _ListenerName, #{enabled := false}) ->
{error, listener_disabled}; {ok, {skipped, listener_disabled}};
do_start_listener(ZoneName, ListenerName, #{type := tcp, bind := ListenOn} = Opts) -> do_start_listener(ZoneName, ListenerName, #{type := tcp, bind := ListenOn} = Opts) ->
esockd:open(listener_id(ZoneName, ListenerName), ListenOn, merge_default(esockd_opts(Opts)), esockd:open(listener_id(ZoneName, ListenerName), ListenOn, merge_default(esockd_opts(Opts)),
{emqx_connection, start_link, {emqx_connection, start_link,
@ -88,25 +89,30 @@ do_start_listener(ZoneName, ListenerName, #{type := ws, bind := ListenOn} = Opts
%% Start MQTT/QUIC listener %% Start MQTT/QUIC listener
do_start_listener(ZoneName, ListenerName, #{type := quic, bind := ListenOn} = Opts) -> do_start_listener(ZoneName, ListenerName, #{type := quic, bind := ListenOn} = Opts) ->
%% @fixme unsure why we need reopen lib and reopen config. case [ A || {quicer, _, _} = A<-application:which_applications() ] of
quicer_nif:open_lib(), [_] ->
quicer_nif:reg_open(), %% @fixme unsure why we need reopen lib and reopen config.
DefAcceptors = erlang:system_info(schedulers_online) * 8, quicer_nif:open_lib(),
ListenOpts = [ {cert, maps:get(certfile, Opts)} quicer_nif:reg_open(),
, {key, maps:get(keyfile, Opts)} DefAcceptors = erlang:system_info(schedulers_online) * 8,
, {alpn, ["mqtt"]} ListenOpts = [ {cert, maps:get(certfile, Opts)}
, {conn_acceptors, maps:get(acceptors, Opts, DefAcceptors)} , {key, maps:get(keyfile, Opts)}
, {idle_timeout_ms, emqx_config:get_zone_conf(ZoneName, [mqtt, idle_timeout])} , {alpn, ["mqtt"]}
], , {conn_acceptors, maps:get(acceptors, Opts, DefAcceptors)}
ConnectionOpts = #{conn_callback => emqx_quic_connection , {idle_timeout_ms, emqx_config:get_zone_conf(ZoneName, [mqtt, idle_timeout])}
, peer_unidi_stream_count => 1 ],
, peer_bidi_stream_count => 10 ConnectionOpts = #{conn_callback => emqx_quic_connection
, zone => ZoneName , peer_unidi_stream_count => 1
, listener => ListenerName , peer_bidi_stream_count => 10
}, , zone => ZoneName
StreamOpts = [], , listener => ListenerName
quicer:start_listener(listener_id(ZoneName, ListenerName), },
port(ListenOn), {ListenOpts, ConnectionOpts, StreamOpts}). StreamOpts = [],
quicer:start_listener(listener_id(ZoneName, ListenerName),
port(ListenOn), {ListenOpts, ConnectionOpts, StreamOpts});
[] ->
{ok, {skipped, quic_app_missing}}
end.
esockd_opts(Opts0) -> esockd_opts(Opts0) ->
Opts1 = maps:with([acceptors, max_connections, proxy_protocol, proxy_protocol_timeout], Opts0), Opts1 = maps:with([acceptors, max_connections, proxy_protocol, proxy_protocol_timeout], Opts0),