feat(quic): bump to quicer 0.0.11
This commit is contained in:
parent
219f159fe7
commit
6349b5e5e0
|
@ -43,7 +43,7 @@
|
||||||
{meck, "0.9.2"},
|
{meck, "0.9.2"},
|
||||||
{proper, "1.4.0"},
|
{proper, "1.4.0"},
|
||||||
{bbmustache, "1.10.0"},
|
{bbmustache, "1.10.0"},
|
||||||
{emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.5.0"}}}
|
{emqtt, {git, "https://github.com/qzhuyan/emqtt", {branch, "dev/william/bump-quicer"}}}
|
||||||
]},
|
]},
|
||||||
{extra_src_dirs, [{"test", [recursive]}]}
|
{extra_src_dirs, [{"test", [recursive]}]}
|
||||||
]}
|
]}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
IsCentos6 = fun() ->
|
IsCentos6 = fun() ->
|
||||||
case file:read_file("/etc/centos-release") of
|
case file:read_file("/etc/centos-release") of
|
||||||
{ok, <<"CentOS release 6", _/binary >>} ->
|
{ok, <<"CentOS release 6", _/binary>>} ->
|
||||||
true;
|
true;
|
||||||
_ ->
|
_ ->
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
IsWin32 = fun() ->
|
IsWin32 = fun() ->
|
||||||
win32 =:= element(1, os:type())
|
win32 =:= element(1, os:type())
|
||||||
end,
|
end,
|
||||||
|
|
||||||
IsMacOS = fun() ->
|
IsMacOS = fun() ->
|
||||||
{unix, darwin} =:= os:type()
|
{unix, darwin} =:= os:type()
|
||||||
|
@ -25,13 +25,14 @@ IsQuicSupp = fun() ->
|
||||||
end,
|
end,
|
||||||
|
|
||||||
Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}},
|
Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}},
|
||||||
Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.9"}}},
|
Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.11"}}}.
|
||||||
|
|
||||||
ExtraDeps = fun(C) ->
|
ExtraDeps = fun(C) ->
|
||||||
{deps, Deps0} = lists:keyfind(deps, 1, C),
|
{deps, Deps0} = lists:keyfind(deps, 1, C),
|
||||||
Deps = Deps0 ++ [Bcrypt || not IsWin32()] ++
|
Deps =
|
||||||
[ Quicer || IsQuicSupp()],
|
Deps0 ++ [Bcrypt || not IsWin32()] ++
|
||||||
lists:keystore(deps, 1, C, {deps, Deps})
|
[Quicer || IsQuicSupp()],
|
||||||
end,
|
lists:keystore(deps, 1, C, {deps, Deps})
|
||||||
|
end,
|
||||||
|
|
||||||
ExtraDeps(CONFIG).
|
ExtraDeps(CONFIG).
|
||||||
|
|
|
@ -324,15 +324,18 @@ do_start_listener(quic, ListenerName, #{bind := ListenOn} = Opts) ->
|
||||||
case [A || {quicer, _, _} = A <- application:which_applications()] of
|
case [A || {quicer, _, _} = A <- application:which_applications()] of
|
||||||
[_] ->
|
[_] ->
|
||||||
DefAcceptors = erlang:system_info(schedulers_online) * 8,
|
DefAcceptors = erlang:system_info(schedulers_online) * 8,
|
||||||
|
IdleTimeout = timer:seconds(maps:get(idle_timeout, Opts)),
|
||||||
ListenOpts = [
|
ListenOpts = [
|
||||||
{cert, maps:get(certfile, Opts)},
|
{cert, maps:get(certfile, Opts)},
|
||||||
{key, maps:get(keyfile, Opts)},
|
{key, maps:get(keyfile, Opts)},
|
||||||
{alpn, ["mqtt"]},
|
{alpn, ["mqtt"]},
|
||||||
{conn_acceptors, lists:max([DefAcceptors, maps:get(acceptors, Opts, 0)])},
|
{conn_acceptors, lists:max([DefAcceptors, maps:get(acceptors, Opts, 0)])},
|
||||||
|
{keep_alive_interval_ms, ceil(IdleTimeout / 3)},
|
||||||
|
{server_resumption_level, 2},
|
||||||
{idle_timeout_ms,
|
{idle_timeout_ms,
|
||||||
lists:max([
|
lists:max([
|
||||||
emqx_config:get_zone_conf(zone(Opts), [mqtt, idle_timeout]) * 3,
|
emqx_config:get_zone_conf(zone(Opts), [mqtt, idle_timeout]) * 3,
|
||||||
timer:seconds(maps:get(idle_timeout, Opts))
|
IdleTimeout
|
||||||
])}
|
])}
|
||||||
],
|
],
|
||||||
ConnectionOpts = #{
|
ConnectionOpts = #{
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-module(emqx_quic_connection).
|
-module(emqx_quic_connection).
|
||||||
|
-include_lib("quicer/include/quicer.hrl").
|
||||||
|
|
||||||
%% Callbacks
|
%% Callbacks
|
||||||
-export([
|
-export([
|
||||||
|
@ -59,5 +60,5 @@ connected(_Conn, S) ->
|
||||||
|
|
||||||
-spec shutdown(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.
|
-spec shutdown(quicer:connection_handler(), cb_state()) -> {ok, cb_state()} | {error, any()}.
|
||||||
shutdown(Conn, S) ->
|
shutdown(Conn, S) ->
|
||||||
quicer:async_close_connection(Conn),
|
quicer:async_shutdown_connection(Conn, ?QUIC_CONNECTION_SHUTDOWN_FLAG_NONE, 0),
|
||||||
{ok, S}.
|
{ok, S}.
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
%% MQTT/QUIC Stream
|
%% MQTT/QUIC Stream
|
||||||
-module(emqx_quic_stream).
|
-module(emqx_quic_stream).
|
||||||
|
-include_lib("quicer/include/quicer.hrl").
|
||||||
|
|
||||||
%% emqx transport Callbacks
|
%% emqx transport Callbacks
|
||||||
-export([
|
-export([
|
||||||
|
@ -38,7 +39,7 @@ wait({ConnOwner, Conn}) ->
|
||||||
receive
|
receive
|
||||||
%% from msquic
|
%% from msquic
|
||||||
{quic, new_stream, Stream} ->
|
{quic, new_stream, Stream} ->
|
||||||
{ok, Stream};
|
{ok, {quic, Conn, Stream}};
|
||||||
{'EXIT', ConnOwner, _Reason} ->
|
{'EXIT', ConnOwner, _Reason} ->
|
||||||
{error, enotconn}
|
{error, enotconn}
|
||||||
end.
|
end.
|
||||||
|
@ -46,18 +47,18 @@ wait({ConnOwner, Conn}) ->
|
||||||
type(_) ->
|
type(_) ->
|
||||||
quic.
|
quic.
|
||||||
|
|
||||||
peername(S) ->
|
peername({quic, Conn, _Stream}) ->
|
||||||
quicer:peername(S).
|
quicer:peername(Conn).
|
||||||
|
|
||||||
sockname(S) ->
|
sockname({quic, Conn, _Stream}) ->
|
||||||
quicer:sockname(S).
|
quicer:sockname(Conn).
|
||||||
|
|
||||||
peercert(_S) ->
|
peercert(_S) ->
|
||||||
%% @todo but unsupported by msquic
|
%% @todo but unsupported by msquic
|
||||||
nossl.
|
nossl.
|
||||||
|
|
||||||
getstat(Socket, Stats) ->
|
getstat({quic, Conn, _Stream}, Stats) ->
|
||||||
case quicer:getstat(Socket, Stats) of
|
case quicer:getstat(Conn, Stats) of
|
||||||
{error, _} -> {error, closed};
|
{error, _} -> {error, closed};
|
||||||
Res -> Res
|
Res -> Res
|
||||||
end.
|
end.
|
||||||
|
@ -84,9 +85,9 @@ getopts(_Socket, _Opts) ->
|
||||||
{buffer, 80000}
|
{buffer, 80000}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
fast_close(Stream) ->
|
fast_close({quic, _Conn, Stream}) ->
|
||||||
%% Stream might be closed already.
|
%% Flush send buffer, gracefully shutdown
|
||||||
_ = quicer:async_close_stream(Stream),
|
quicer:async_shutdown_stream(Stream),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
-spec ensure_ok_or_exit(atom(), list(term())) -> term().
|
-spec ensure_ok_or_exit(atom(), list(term())) -> term().
|
||||||
|
@ -102,9 +103,7 @@ ensure_ok_or_exit(Fun, Args = [Sock | _]) when is_atom(Fun), is_list(Args) ->
|
||||||
Result
|
Result
|
||||||
end.
|
end.
|
||||||
|
|
||||||
async_send(Stream, Data, Options) when is_list(Data) ->
|
async_send({quic, _Conn, Stream}, Data, _Options) ->
|
||||||
async_send(Stream, iolist_to_binary(Data), Options);
|
|
||||||
async_send(Stream, Data, _Options) when is_binary(Data) ->
|
|
||||||
case quicer:send(Stream, Data) of
|
case quicer:send(Stream, Data) of
|
||||||
{ok, _Len} -> ok;
|
{ok, _Len} -> ok;
|
||||||
Other -> Other
|
Other -> Other
|
||||||
|
|
|
@ -252,7 +252,8 @@ t_connect_will_message(Config) ->
|
||||||
{ok, _, [2]} = emqtt:subscribe(Client4, Topic, qos2),
|
{ok, _, [2]} = emqtt:subscribe(Client4, Topic, qos2),
|
||||||
ok = emqtt:disconnect(Client3),
|
ok = emqtt:disconnect(Client3),
|
||||||
%% [MQTT-3.1.2-10]
|
%% [MQTT-3.1.2-10]
|
||||||
?assertEqual(0, length(receive_messages(1))),
|
MsgRecv = receive_messages(1),
|
||||||
|
?assertEqual([], MsgRecv),
|
||||||
ok = emqtt:disconnect(Client4).
|
ok = emqtt:disconnect(Client4).
|
||||||
|
|
||||||
t_batch_subscribe(init, Config) ->
|
t_batch_subscribe(init, Config) ->
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -600,7 +600,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
defp quicer_dep() do
|
defp quicer_dep() do
|
||||||
if enable_quicer?(),
|
if enable_quicer?(),
|
||||||
# in conflict with emqx and emqtt
|
# in conflict with emqx and emqtt
|
||||||
do: [{:quicer, github: "emqx/quic", tag: "0.0.9", override: true}],
|
do: [{:quicer, github: "emqx/quic", tag: "0.0.11", override: true}],
|
||||||
else: []
|
else: []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
, {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.2"}}}
|
, {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.2"}}}
|
||||||
, {replayq, "0.3.4"}
|
, {replayq, "0.3.4"}
|
||||||
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
|
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
|
||||||
, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.5.1"}}}
|
, {emqtt, {git, "https://github.com/qzhuyan/emqtt", {branch, "dev/william/bump-quicer"}}}
|
||||||
, {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}}
|
, {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}}
|
||||||
, {observer_cli, "1.7.1"} % NOTE: depends on recon 2.5.x
|
, {observer_cli, "1.7.1"} % NOTE: depends on recon 2.5.x
|
||||||
, {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.3"}}}
|
, {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.3"}}}
|
||||||
|
|
|
@ -38,7 +38,7 @@ bcrypt() ->
|
||||||
{bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}}.
|
{bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}}.
|
||||||
|
|
||||||
quicer() ->
|
quicer() ->
|
||||||
{quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.9"}}}.
|
{quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.11"}}}.
|
||||||
|
|
||||||
jq() ->
|
jq() ->
|
||||||
{jq, {git, "https://github.com/emqx/jq", {tag, "v0.3.4"}}}.
|
{jq, {git, "https://github.com/emqx/jq", {tag, "v0.3.4"}}}.
|
||||||
|
|
Loading…
Reference in New Issue