From 2d09a054e328ff824b28354c80d917549341805e Mon Sep 17 00:00:00 2001 From: William Yang Date: Wed, 2 Nov 2022 09:46:48 +0100 Subject: [PATCH] chore: add some typing --- apps/emqx/rebar.config.script | 2 +- apps/emqx/src/emqx_quic_connection.erl | 6 +++++- rebar.config | 2 +- rebar.config.erl | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/emqx/rebar.config.script b/apps/emqx/rebar.config.script index 75f748017..0ecd21715 100644 --- a/apps/emqx/rebar.config.script +++ b/apps/emqx/rebar.config.script @@ -24,7 +24,7 @@ IsQuicSupp = fun() -> end, 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.16"}}}. +Quicer = {quicer, {git, "https://github.com/qzhuyan/quic.git", {branch, "dev/william/multi-streams"}}}. %% @TODO revert ExtraDeps = fun(C) -> {deps, Deps0} = lists:keyfind(deps, 1, C), diff --git a/apps/emqx/src/emqx_quic_connection.erl b/apps/emqx/src/emqx_quic_connection.erl index 6da9ec9a8..22d068237 100644 --- a/apps/emqx/src/emqx_quic_connection.erl +++ b/apps/emqx/src/emqx_quic_connection.erl @@ -40,9 +40,11 @@ new_stream/3 ]). --type cb_state() :: map() | proplists:proplist(). +-type cb_state() :: map(). -type cb_ret() :: ok. +-spec init(map() | list()) -> cb_state(). + init(ConnOpts) when is_list(ConnOpts) -> init(maps:from_list(ConnOpts)); init(#{stream_opts := SOpts} = S) when is_list(SOpts) -> @@ -50,6 +52,8 @@ init(#{stream_opts := SOpts} = S) when is_list(SOpts) -> init(ConnOpts) when is_map(ConnOpts) -> {ok, ConnOpts}. +-spec closed(quicer:conneciton_hanlder(), quicer:conn_closed_props(), cb_state()) -> + {ok, cb_state()} | {error, any()}. closed(_Conn, #{is_peer_acked := true}, S) -> {stop, normal, S}; closed(_Conn, #{is_peer_acked := false}, S) -> diff --git a/rebar.config b/rebar.config index ffdb7407a..76402897b 100644 --- a/rebar.config +++ b/rebar.config @@ -62,7 +62,7 @@ , {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.3"}}} , {replayq, {git, "https://github.com/emqx/replayq.git", {tag, "0.3.7"}}} , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}} - , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.7.0"}}} + , {emqtt, {git, "https://github.com/qzhuyan/emqtt", {branch, "dev/william/multi-streams"}}} %% @TODO revert , {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}} , {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"}}} diff --git a/rebar.config.erl b/rebar.config.erl index 4ff94bd78..9da71355b 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -39,7 +39,8 @@ 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.16"}}}. + %% @TODO revert + {quicer, {git, "https://github.com/qzhuyan/quic.git", {branch, "dev/william/multi-streams"}}}. jq() -> {jq, {git, "https://github.com/emqx/jq", {tag, "v0.3.9"}}}.