feat(quic): toggle QUIC listener and fix ci test

This commit is contained in:
William Yang 2021-07-20 14:06:23 +02:00 committed by turtleDeng
parent f913cf9617
commit 7521d09079
5 changed files with 27 additions and 6 deletions

View File

@ -39,7 +39,7 @@ emqx_test(){
unzip -q "${PACKAGE_PATH}/${packagename}"
export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60 \
EMQX_MQTT__MAX_TOPIC_ALIAS=10
[[ $(arch) == *arm* || $(arch) == aarch64 ]] && export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT=''
[[ $(arch) == *arm* || $(arch) == aarch64 ]] && export EMQX_ZONES__DEFAULT__LISTENERS__MQTT_QUIC__ENABLED=false
# sed -i '/emqx_telemetry/d' "${PACKAGE_PATH}"/emqx/data/loaded_plugins
echo "running ${packagename} start"
@ -125,7 +125,7 @@ export EMQX_MQTT__MAX_TOPIC_ALIAS=10
EOF
## 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
export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT=''
export EMQX_ZONES__DEFAULT__LISTENERS__MQTT_QUIC__ENABLED=false
EOF
else
echo "Error: cannot locate emqx_vars"

View File

@ -1528,7 +1528,6 @@ zones.default {
listeners.mqtt_quic:
{
## The type of the listener.
##
## @doc zones.<name>.listeners.<name>.type

View File

@ -13,7 +13,7 @@ IsWin32 = fun() ->
IsQuicSupp = fun() ->
not (IsCentos6() orelse IsWin32() orelse
false =/= os:getenv("EMQX_BUILD_WITHOUT_QUIC")
false =/= os:getenv("BUILD_WITHOUT_QUIC")
)
end,

View File

@ -45,6 +45,9 @@ start_listener(ListenerId) ->
-spec start_listener(atom(), atom(), map()) -> ok | {error, term()}.
start_listener(ZoneName, ListenerName, #{type := Type, bind := Bind} = Conf) ->
case do_start_listener(ZoneName, ListenerName, Conf) of
{error, listener_disabled} ->
console_print("- Skip - starting ~s listener ~s on ~s ~n",
[Type, listener_id(ZoneName, ListenerName), format(Bind)]);
{ok, _} ->
console_print("Start ~s listener ~s on ~s successfully.~n",
[Type, listener_id(ZoneName, ListenerName), format(Bind)]);
@ -63,7 +66,9 @@ console_print(_Fmt, _Args) -> ok.
%% Start MQTT/TCP listener
-spec(do_start_listener(atom(), atom(), map())
-> {ok, pid()} | {error, term()}).
-> {ok, pid() | {skipped, atom()}} | {error, term()}).
do_start_listener(_ZoneName, _ListenerName, #{enabled := false}) ->
{error, listener_disabled};
do_start_listener(ZoneName, ListenerName, #{type := tcp, bind := ListenOn} = Opts) ->
esockd:open(listener_id(ZoneName, ListenerName), ListenOn, merge_default(esockd_opts(Opts)),
{emqx_connection, start_link,

View File

@ -1,3 +1,19 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2017-2021 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%--------------------------------------------------------------------
-module(emqx_schema).
-dialyzer(no_return).
@ -374,7 +390,8 @@ fields("mqtt_ws_listener") ->
] ++ mqtt_listener();
fields("mqtt_quic_listener") ->
[ {"type", t(quic)}
[ {"enabled", t(boolean(), undefined, true)}
, {"type", t(quic)}
, {"certfile", t(string(), undefined, undefined)}
, {"keyfile", t(string(), undefined, undefined)}
, {"ciphers", t(comma_separated_list(), undefined, "TLS_AES_256_GCM_SHA384,"