diff --git a/Makefile b/Makefile index 16c9795b1..0d9bfb7c4 100644 --- a/Makefile +++ b/Makefile @@ -113,26 +113,3 @@ rebar-clean: distclean:: @rm -rf _build cover deps logs log data @rm -f rebar.lock compile_commands.json cuttlefish - -## Below are for version consistency check during erlang.mk and rebar3 dual mode support -none= -space = $(none) $(none) -comma = , -quote = \" -curly_l = "{" -curly_r = "}" -dep-versions = [$(foreach dep,$(DEPS) $(BUILD_DEPS),$(curly_l)$(dep),$(quote)$(word $(words $(dep_$(dep))),$(dep_$(dep)))$(quote)$(curly_r)$(comma))[]] - -.PHONY: dep-vsn-check -dep-vsn-check: - $(verbose) erl -noshell -eval \ - "MkVsns = lists:sort(lists:flatten($(dep-versions))), \ - {ok, Conf} = file:consult('rebar.config'), \ - {_, Deps1} = lists:keyfind(deps, 1, Conf), \ - {_, Deps2} = lists:keyfind(github_emqx_deps, 1, Conf), \ - F = fun({N, V}) when is_list(V) -> {N, V}; ({N, {git, _, {branch, V}}}) -> {N, V} end, \ - RebarVsns = lists:sort(lists:map(F, Deps1 ++ Deps2)), \ - case {RebarVsns -- MkVsns, MkVsns -- RebarVsns} of \ - {[], []} -> halt(0); \ - {Rebar, Mk} -> erlang:error({deps_version_discrepancy, [{rebar, Rebar}, {mk, Mk}]}) \ - end." diff --git a/etc/emqx.conf b/etc/emqx.conf index fc37427e6..d762aef7e 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -286,32 +286,32 @@ rpc.tcp_client_port = 5369 ## RCP Client connect timeout. ## ## Value: Seconds -rpc.connect_timeout = 5000 +rpc.connect_timeout = 5s ## TCP send timeout of RPC client and server. ## ## Value: Seconds -rpc.send_timeout = 5000 +rpc.send_timeout = 5s ## Authentication timeout ## ## Value: Seconds -rpc.authentication_timeout = 5000 +rpc.authentication_timeout = 5s ## Default receive timeout for call() functions ## ## Value: Seconds -rpc.call_receive_timeout = 15000 +rpc.call_receive_timeout = 15s ## Socket idle keepalive. ## ## Value: Seconds -rpc.socket_keepalive_idle = 900 +rpc.socket_keepalive_idle = 900s ## TCP Keepalive probes interval. ## -## Value: Integer -rpc.socket_keepalive_interval = 75 +## Value: Seconds +rpc.socket_keepalive_interval = 75s ## Probes lost to close the connection ## @@ -947,7 +947,7 @@ listener.tcp.internal.send_timeout = 5s ## See: listener.tcp.$name.send_timeout_close ## ## Value: on | off -listener.tcp.external.send_timeout_close = on +listener.tcp.internal.send_timeout_close = on ## The TCP receive buffer(os kernel) for internal MQTT connections. ## @@ -1596,29 +1596,29 @@ listener.wss.external.ciphers = ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-G ## Value: enum ## manual ## auto -bridge.aws.start_type = manual +## bridge.aws.start_type = manual ## Bridge reconnect time. ## ## Value: Duration ## Default: 30 seconds -bridge.aws.reconnect_interval = 30s +## bridge.aws.reconnect_interval = 30s ## Retry interval for bridge QoS1 message delivering. ## ## Value: Duration -bridge.aws.retry_interval = 20s +## bridge.aws.retry_interval = 20s ## Inflight size. ## ## Value: Integer -bridge.aws.max_inflight = 32 +## bridge.aws.max_inflight = 32 ## Bridge address: node name for local bridge, host:port for remote. ## ## Value: String ## Example: emqx@127.0.0.1, 127.0.0.1:1883 -bridge.aws.address = 127.0.0.1:1883 +## bridge.aws.address = 127.0.0.1:1883 ## Protocol version of the bridge. ## @@ -1626,12 +1626,12 @@ bridge.aws.address = 127.0.0.1:1883 ## - mqttv5 ## - mqttv4 ## - mqttv3 -bridge.aws.proto_ver = mqttv4 +## bridge.aws.proto_ver = mqttv4 ## The ClientId of a remote bridge. ## ## Value: String -bridge.aws.client_id = bridge_aws +## bridge.aws.client_id = bridge_aws ## The Clean start flag of a remote bridge. ## @@ -1645,62 +1645,62 @@ bridge.aws.client_id = bridge_aws ## The username for a remote bridge. ## ## Value: String -bridge.aws.username = user +## bridge.aws.username = user ## The password for a remote bridge. ## ## Value: String -bridge.aws.password = passwd +## bridge.aws.password = passwd ## Mountpoint of the bridge. ## ## Value: String -bridge.aws.mountpoint = bridge/aws/${node}/ +## bridge.aws.mountpoint = bridge/aws/${node}/ ## Ping interval of a down bridge. ## ## Value: Duration ## Default: 10 seconds -bridge.aws.keepalive = 60s +## bridge.aws.keepalive = 60s ## Forward message topics ## ## Value: String ## Example: topic1/#,topic2/# -bridge.aws.forwards = topic1/#,topic2/# +## bridge.aws.forwards = topic1/#,topic2/# ## Subscriptions of the bridge topic. ## ## Value: String -bridge.aws.subscription.1.topic = cmd/topic1 +## bridge.aws.subscription.1.topic = cmd/topic1 ## Subscriptions of the bridge qos. ## ## Value: Number -bridge.aws.subscription.1.qos = 1 +## bridge.aws.subscription.1.qos = 1 ## Subscriptions of the bridge topic. ## ## Value: String -bridge.aws.subscription.2.topic = cmd/topic2 +## bridge.aws.subscription.2.topic = cmd/topic2 ## Subscriptions of the bridge qos. ## ## Value: Number -bridge.aws.subscription.2.qos = 1 +## bridge.aws.subscription.2.qos = 1 ## If enabled, queue would be written into disk more quickly. ## However, If disabled, some message would be dropped in ## the situation emqx crashed. ## ## Value: on | off -bridge.aws.queue.mem_cache = on +## bridge.aws.queue.mem_cache = on ## Batch size for buffer queue stored ## ## Value: Integer ## default: 1000 -bridge.aws.queue.batch_size = 1000 +## bridge.aws.queue.batch_size = 1000 ## Base directory for replayq to store messages on disk ## If this config entry is missing or set to undefined, @@ -1709,18 +1709,18 @@ bridge.aws.queue.batch_size = 1000 ## this config entry would have no effect on mqueue ## ## Value: String -bridge.aws.queue.replayq_dir = {{ platform_data_dir }}/emqx_aws_bridge/ +## bridge.aws.queue.replayq_dir = {{ platform_data_dir }}/emqx_aws_bridge/ ## Replayq segment size ## ## Value: Bytesize -bridge.aws.queue.replayq_seg_bytes = 10MB +## bridge.aws.queue.replayq_seg_bytes = 10MB ## Bribge to remote server via SSL. ## ## Value: on | off -bridge.aws.ssl = off +## bridge.aws.ssl = off ## PEM-encoded CA certificates of the bridge. ## diff --git a/include/emqx.hrl b/include/emqx.hrl index 84feb16b7..fba079b91 100644 --- a/include/emqx.hrl +++ b/include/emqx.hrl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -19,7 +19,7 @@ %% Banner %%-------------------------------------------------------------------- --define(COPYRIGHT, "Copyright (c) 2018 EMQ Technologies Co., Ltd"). +-define(COPYRIGHT, "Copyright (c) 2013-2019 EMQ Technologies Co., Ltd"). -define(LICENSE_MESSAGE, "Licensed under the Apache License, Version 2.0"). diff --git a/include/emqx_mqtt.hrl b/include/emqx_mqtt.hrl index 3021e913a..7e7670112 100644 --- a/include/emqx_mqtt.hrl +++ b/include/emqx_mqtt.hrl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/include/logger.hrl b/include/logger.hrl index 6a94d6bc9..a2ee404d9 100644 --- a/include/logger.hrl +++ b/include/logger.hrl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -24,7 +24,7 @@ -define(NOTICE(Format, Args), ?LOG(notice, Format, Args)). -define(WARN(Format), ?LOG(warning, Format, [])). --define(WARN(Format, Args), ?LOG(warning, Format, [])). +-define(WARN(Format, Args), ?LOG(warning, Format, Args)). -define(ERROR(Format), ?LOG(error, Format, [])). -define(ERROR(Format, Args), ?LOG(error, Format, Args)). diff --git a/include/types.hrl b/include/types.hrl new file mode 100644 index 000000000..8032bfe7e --- /dev/null +++ b/include/types.hrl @@ -0,0 +1,22 @@ +%% Copyright (c) 2013-2019 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. + +-type(maybe(T) :: undefined | T). + +-type(startlink_ret() :: {ok, pid()} | ignore | {error, term()}). + +-type(ok_or_error(Reason) :: ok | {error, Reason}). + +-type(ok_or_error(Value, Reason) :: {ok, Value} | {error, Reason}). + diff --git a/priv/emqx.schema b/priv/emqx.schema index 1f8e4fa6b..2136bacad 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -324,38 +324,38 @@ end}. %% Client connect timeout {mapping, "rpc.connect_timeout", "gen_rpc.connect_timeout", [ - {default, 5000}, - {datatype, integer} + {default, "5s"}, + {datatype, {duration, ms}} ]}. %% Client and Server send timeout {mapping, "rpc.send_timeout", "gen_rpc.send_timeout", [ {default, 5000}, - {datatype, integer} + {datatype, {duration, ms}} ]}. %% Authentication timeout {mapping, "rpc.authentication_timeout", "gen_rpc.authentication_timeout", [ {default, 5000}, - {datatype, integer} + {datatype, {duration, ms}} ]}. %% Default receive timeout for call() functions {mapping, "rpc.call_receive_timeout", "gen_rpc.call_receive_timeout", [ {default, 15000}, - {datatype, integer} + {datatype, {duration, ms}} ]}. %% Socket keepalive configuration {mapping, "rpc.socket_keepalive_idle", "gen_rpc.socket_keepalive_idle", [ {default, 7200}, - {datatype, integer} + {datatype, {duration, s}} ]}. %% Seconds between probes {mapping, "rpc.socket_keepalive_interval", "gen_rpc.socket_keepalive_interval", [ {default, 75}, - {datatype, integer} + {datatype, {duration, s}} ]}. %% Probes lost to close the connection diff --git a/rebar.config.script b/rebar.config.script index aed271af8..2c04540dc 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -1,4 +1,3 @@ - CONFIG0 = case os:getenv("REBAR_GIT_CLONE_OPTIONS") of "--depth 1" -> CONFIG; diff --git a/src/emqx.app.src b/src/emqx.app.src index d4613a5af..f9c174ae3 100644 --- a/src/emqx.app.src +++ b/src/emqx.app.src @@ -3,7 +3,8 @@ {vsn,"git"}, {modules,[]}, {registered,[emqx_sup]}, - {applications,[kernel,stdlib,jsx,gproc,gen_rpc,esockd,cowboy,replayq]}, + {applications,[kernel,stdlib,jsx,gproc,gen_rpc,esockd,cowboy, + replayq]}, {env,[]}, {mod,{emqx_app,[]}}, {maintainers,["Feng Lee "]}, diff --git a/src/emqx.erl b/src/emqx.erl index 728b35cfc..4fd6687e5 100644 --- a/src/emqx.erl +++ b/src/emqx.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -15,6 +15,7 @@ -module(emqx). -include("emqx.hrl"). +-include("types.hrl"). %% Start/Stop the application -export([start/0, restart/1, is_running/1, stop/0]). @@ -167,6 +168,7 @@ reboot() -> %%------------------------------------------------------------------------------ %% Internal functions %%------------------------------------------------------------------------------ + reload_config(ConfFile) -> {ok, [Conf]} = file:consult(ConfFile), lists:foreach(fun({App, Vals}) -> diff --git a/src/emqx_access_control.erl b/src/emqx_access_control.erl index 1c43eb746..8b38889e7 100644 --- a/src/emqx_access_control.erl +++ b/src/emqx_access_control.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_access_rule.erl b/src/emqx_access_rule.erl index 72a3d09b2..27a6ab821 100644 --- a/src/emqx_access_rule.erl +++ b/src/emqx_access_rule.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_acl_cache.erl b/src/emqx_acl_cache.erl index 5be92814d..fb63e0ad5 100644 --- a/src/emqx_acl_cache.erl +++ b/src/emqx_acl_cache.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_acl_internal.erl b/src/emqx_acl_internal.erl index 1effd1709..6d5b9885e 100644 --- a/src/emqx_acl_internal.erl +++ b/src/emqx_acl_internal.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_acl_mod.erl b/src/emqx_acl_mod.erl index 716b27967..c75532441 100644 --- a/src/emqx_acl_mod.erl +++ b/src/emqx_acl_mod.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_alarm_mgr.erl b/src/emqx_alarm_mgr.erl index 6573904d6..cfb99678e 100644 --- a/src/emqx_alarm_mgr.erl +++ b/src/emqx_alarm_mgr.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_app.erl b/src/emqx_app.erl index 977eabc2f..30483dbde 100644 --- a/src/emqx_app.erl +++ b/src/emqx_app.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_auth_mod.erl b/src/emqx_auth_mod.erl index 00ecb659a..615b4e528 100644 --- a/src/emqx_auth_mod.erl +++ b/src/emqx_auth_mod.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_banned.erl b/src/emqx_banned.erl index 9da05cd15..a35365d4e 100644 --- a/src/emqx_banned.erl +++ b/src/emqx_banned.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -18,6 +18,7 @@ -include("emqx.hrl"). -include("logger.hrl"). +-include("types.hrl"). %% Mnesia bootstrap -export([mnesia/1]). @@ -50,7 +51,7 @@ mnesia(copy) -> ok = ekka_mnesia:copy_table(?TAB). %% @doc Start the banned server. --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). diff --git a/src/emqx_base62.erl b/src/emqx_base62.erl index 1a9db245a..79c19a508 100644 --- a/src/emqx_base62.erl +++ b/src/emqx_base62.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_batch.erl b/src/emqx_batch.erl index ffa9a7224..f2592dd93 100644 --- a/src/emqx_batch.erl +++ b/src/emqx_batch.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_bridge.erl b/src/emqx_bridge.erl index 5d3ae3e91..acfe844f1 100644 --- a/src/emqx_bridge.erl +++ b/src/emqx_bridge.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_bridge_sup.erl b/src/emqx_bridge_sup.erl index 3911da2a6..baa857074 100644 --- a/src/emqx_bridge_sup.erl +++ b/src/emqx_bridge_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_broker.erl b/src/emqx_broker.erl index a8da25ce6..b43fa5cff 100644 --- a/src/emqx_broker.erl +++ b/src/emqx_broker.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -18,6 +18,7 @@ -include("emqx.hrl"). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/2]). -export([subscribe/1, subscribe/2, subscribe/3]). @@ -53,7 +54,7 @@ %% Guards -define(is_subid(Id), (is_binary(Id) orelse is_atom(Id))). --spec(start_link(atom(), pos_integer()) -> emqx_types:startlink_ret()). +-spec(start_link(atom(), pos_integer()) -> startlink_ret()). start_link(Pool, Id) -> ok = create_tabs(), gen_server:start_link({local, emqx_misc:proc_name(?BROKER, Id)}, @@ -322,7 +323,7 @@ subscribed(SubId, Topic) when ?is_subid(SubId) -> SubPid = emqx_broker_helper:lookup_subpid(SubId), ets:member(?SUBOPTION, {SubPid, Topic}). --spec(get_subopts(pid(), emqx_topic:topic()) -> emqx_types:subopts() | undefined). +-spec(get_subopts(pid(), emqx_topic:topic()) -> maybe(emqx_types:subopts())). get_subopts(SubPid, Topic) when is_pid(SubPid), is_binary(Topic) -> lookup_value(?SUBOPTION, {SubPid, Topic}); get_subopts(SubId, Topic) when ?is_subid(SubId) -> diff --git a/src/emqx_broker_helper.erl b/src/emqx_broker_helper.erl index d7eb6bfa2..f5b880163 100644 --- a/src/emqx_broker_helper.erl +++ b/src/emqx_broker_helper.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -17,6 +17,7 @@ -behaviour(gen_server). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/0]). -export([register_sub/2]). @@ -35,7 +36,7 @@ -define(BATCH_SIZE, 100000). --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?HELPER}, ?MODULE, [], []). @@ -50,7 +51,7 @@ register_sub(SubPid, SubId) when is_pid(SubPid) -> error(subid_conflict) end. --spec(lookup_subid(pid()) -> emqx_types:subid() | undefined). +-spec(lookup_subid(pid()) -> maybe(emqx_types:subid())). lookup_subid(SubPid) when is_pid(SubPid) -> emqx_tables:lookup_value(?SUBMON, SubPid). diff --git a/src/emqx_broker_sup.erl b/src/emqx_broker_sup.erl index 5b1c0a0e7..05154f393 100644 --- a/src/emqx_broker_sup.erl +++ b/src/emqx_broker_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_cli.erl b/src/emqx_cli.erl index f7d513e9d..37b2f17fb 100644 --- a/src/emqx_cli.erl +++ b/src/emqx_cli.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_client.erl b/src/emqx_client.erl index 1f8c2a22e..7ebd40769 100644 --- a/src/emqx_client.erl +++ b/src/emqx_client.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -16,6 +16,7 @@ -behaviour(gen_statem). +-include("types.hrl"). -include("emqx_mqtt.hrl"). -export([start_link/0, start_link/1]). @@ -112,12 +113,12 @@ bridge_mode :: boolean(), client_id :: binary(), clean_start :: boolean(), - username :: binary() | undefined, - password :: binary() | undefined, + username :: maybe(binary()), + password :: maybe(binary()), proto_ver :: emqx_mqtt_types:version(), proto_name :: iodata(), keepalive :: non_neg_integer(), - keepalive_timer :: reference() | undefined, + keepalive_timer :: maybe(reference()), force_ping :: boolean(), paused :: boolean(), will_flag :: boolean(), diff --git a/src/emqx_client_sock.erl b/src/emqx_client_sock.erl index 505454e2d..e71eef169 100644 --- a/src/emqx_client_sock.erl +++ b/src/emqx_client_sock.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_cm.erl b/src/emqx_cm.erl index 1d5ae0c58..01bab4c78 100644 --- a/src/emqx_cm.erl +++ b/src/emqx_cm.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -18,6 +18,7 @@ -include("emqx.hrl"). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/0]). @@ -46,7 +47,7 @@ -define(BATCH_SIZE, 100000). %% @doc Start the connection manager. --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?CM}, ?MODULE, [], []). @@ -121,7 +122,7 @@ set_conn_stats(ClientId, ConnPid, Stats) when is_binary(ClientId), is_pid(ConnPi ets:insert(?CONN_STATS_TAB, {Conn, Stats}). %% @doc Lookup connection pid. --spec(lookup_conn_pid(emqx_types:client_id()) -> pid() | undefined). +-spec(lookup_conn_pid(emqx_types:client_id()) -> maybe(pid())). lookup_conn_pid(ClientId) when is_binary(ClientId) -> emqx_tables:lookup_value(?CONN_TAB, ClientId). diff --git a/src/emqx_cm_sup.erl b/src/emqx_cm_sup.erl index e8c99c16b..6b0a8fb15 100644 --- a/src/emqx_cm_sup.erl +++ b/src/emqx_cm_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_config.erl b/src/emqx_config.erl index bab3eab56..5be039cf1 100644 --- a/src/emqx_config.erl +++ b/src/emqx_config.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_connection.erl b/src/emqx_connection.erl index 8859a7152..da75d211e 100644 --- a/src/emqx_connection.erl +++ b/src/emqx_connection.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_ctl.erl b/src/emqx_ctl.erl index 13cfab945..df7c1d1c9 100644 --- a/src/emqx_ctl.erl +++ b/src/emqx_ctl.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_flapping.erl b/src/emqx_flapping.erl index c1cefd893..c3d0d8abd 100644 --- a/src/emqx_flapping.erl +++ b/src/emqx_flapping.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_frame.erl b/src/emqx_frame.erl index 075f0a11e..4d958a036 100644 --- a/src/emqx_frame.erl +++ b/src/emqx_frame.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_gc.erl b/src/emqx_gc.erl index d608954a0..17bafa8ff 100644 --- a/src/emqx_gc.erl +++ b/src/emqx_gc.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -21,6 +21,8 @@ -module(emqx_gc). +-include("types.hrl"). + -export([init/1, run/3, info/1, reset/1]). -type(opts() :: #{count => integer(), @@ -35,7 +37,7 @@ -define(ENABLED(X), (is_integer(X) andalso X > 0)). %% @doc Initialize force GC state. --spec(init(opts() | false) -> gc_state() | undefined). +-spec(init(opts() | false) -> maybe(gc_state())). init(#{count := Count, bytes := Bytes}) -> Cnt = [{cnt, {Count, Count}} || ?ENABLED(Count)], Oct = [{oct, {Bytes, Bytes}} || ?ENABLED(Bytes)], @@ -61,7 +63,7 @@ run([{K, N}|T], St) -> end. %% @doc Info of GC state. --spec(info(gc_state()) -> map() | undefined). +-spec(info(gc_state()) -> maybe(map())). info({?MODULE, St}) -> St; info(undefined) -> diff --git a/src/emqx_gen_mod.erl b/src/emqx_gen_mod.erl index 42466fdd9..dc9304f98 100644 --- a/src/emqx_gen_mod.erl +++ b/src/emqx_gen_mod.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_guid.erl b/src/emqx_guid.erl index fa9139ebd..57baebaaf 100644 --- a/src/emqx_guid.erl +++ b/src/emqx_guid.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_hooks.erl b/src/emqx_hooks.erl index a2e08a439..b3ab3aa74 100644 --- a/src/emqx_hooks.erl +++ b/src/emqx_hooks.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -17,6 +17,7 @@ -behaviour(gen_server). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/0, stop/0]). @@ -42,7 +43,7 @@ -define(TAB, ?MODULE). -define(SERVER, ?MODULE). --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], [{hibernate_after, 1000}]). diff --git a/src/emqx_inflight.erl b/src/emqx_inflight.erl index 876052974..da80e0b30 100644 --- a/src/emqx_inflight.erl +++ b/src/emqx_inflight.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_json.erl b/src/emqx_json.erl index 9c0740b33..76eeab0be 100644 --- a/src/emqx_json.erl +++ b/src/emqx_json.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_keepalive.erl b/src/emqx_keepalive.erl index 25740b099..2d9b0513f 100644 --- a/src/emqx_keepalive.erl +++ b/src/emqx_keepalive.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_kernel_sup.erl b/src/emqx_kernel_sup.erl index 6289437ac..bd98ccbdf 100644 --- a/src/emqx_kernel_sup.erl +++ b/src/emqx_kernel_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_listeners.erl b/src/emqx_listeners.erl index 6987f03f9..2a7375a7f 100644 --- a/src/emqx_listeners.erl +++ b/src/emqx_listeners.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_local_bridge.erl b/src/emqx_local_bridge.erl index df2dda686..0521e6d3f 100644 --- a/src/emqx_local_bridge.erl +++ b/src/emqx_local_bridge.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_local_bridge_sup.erl b/src/emqx_local_bridge_sup.erl index fed9f28a7..db349b94d 100644 --- a/src/emqx_local_bridge_sup.erl +++ b/src/emqx_local_bridge_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_local_bridge_sup_sup.erl b/src/emqx_local_bridge_sup_sup.erl index 0483552b2..8a61d5936 100644 --- a/src/emqx_local_bridge_sup_sup.erl +++ b/src/emqx_local_bridge_sup_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_logger.erl b/src/emqx_logger.erl index 72ba9d8d1..9d215affa 100644 --- a/src/emqx_logger.erl +++ b/src/emqx_logger.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -134,4 +134,4 @@ set_all_log_handlers_level([], _NewLevel, _NewHanlder) -> rollback([{ID, Level} | List]) -> emqx_logger:set_log_handler_level(ID, Level), rollback(List); -rollback([]) -> ok. \ No newline at end of file +rollback([]) -> ok. diff --git a/src/emqx_logger_formatter.erl b/src/emqx_logger_formatter.erl index 3c5d9fc16..034eb8d36 100644 --- a/src/emqx_logger_formatter.erl +++ b/src/emqx_logger_formatter.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2017-2018. All Rights Reserved. +%% Copyright Ericsson AB 2017-2013-2019. 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. diff --git a/src/emqx_message.erl b/src/emqx_message.erl index 9763d4c62..7e5388778 100644 --- a/src/emqx_message.erl +++ b/src/emqx_message.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_metrics.erl b/src/emqx_metrics.erl index 5453f6ad3..41176c7e2 100644 --- a/src/emqx_metrics.erl +++ b/src/emqx_metrics.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -15,6 +15,7 @@ -module(emqx_metrics). -include("logger.hrl"). +-include("types.hrl"). -include("emqx_mqtt.hrl"). -export([start_link/0]). @@ -87,7 +88,7 @@ -define(SERVER, ?MODULE). %% @doc Start the metrics server. --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). diff --git a/src/emqx_misc.erl b/src/emqx_misc.erl index 38bc1c2b0..c8f5449b8 100644 --- a/src/emqx_misc.erl +++ b/src/emqx_misc.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_mod_presence.erl b/src/emqx_mod_presence.erl index 59c675f9a..090a846cd 100644 --- a/src/emqx_mod_presence.erl +++ b/src/emqx_mod_presence.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_mod_rewrite.erl b/src/emqx_mod_rewrite.erl index 25faef166..b07694c56 100644 --- a/src/emqx_mod_rewrite.erl +++ b/src/emqx_mod_rewrite.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_mod_subscription.erl b/src/emqx_mod_subscription.erl index aed7f5af2..bba4e2ebf 100644 --- a/src/emqx_mod_subscription.erl +++ b/src/emqx_mod_subscription.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_mod_sup.erl b/src/emqx_mod_sup.erl index ca5a3d61c..1361854ea 100644 --- a/src/emqx_mod_sup.erl +++ b/src/emqx_mod_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_modules.erl b/src/emqx_modules.erl index 60c4b6351..6f27256d0 100644 --- a/src/emqx_modules.erl +++ b/src/emqx_modules.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_mountpoint.erl b/src/emqx_mountpoint.erl index f2046d5ee..544b986c1 100644 --- a/src/emqx_mountpoint.erl +++ b/src/emqx_mountpoint.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_mqtt_caps.erl b/src/emqx_mqtt_caps.erl index 5f919d9c0..8a3211ec0 100644 --- a/src/emqx_mqtt_caps.erl +++ b/src/emqx_mqtt_caps.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_mqtt_props.erl b/src/emqx_mqtt_props.erl index f4374d0d0..71767537b 100644 --- a/src/emqx_mqtt_props.erl +++ b/src/emqx_mqtt_props.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_mqtt_types.erl b/src/emqx_mqtt_types.erl index 71451cca7..cb797e36a 100644 --- a/src/emqx_mqtt_types.erl +++ b/src/emqx_mqtt_types.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_mqueue.erl b/src/emqx_mqueue.erl index 48b0fa439..20a08ba9f 100644 --- a/src/emqx_mqueue.erl +++ b/src/emqx_mqueue.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -46,6 +46,7 @@ -module(emqx_mqueue). -include("emqx.hrl"). +-include("types.hrl"). -include("emqx_mqtt.hrl"). -export([init/1]). @@ -117,7 +118,7 @@ stats(#mqueue{max_len = MaxLen, dropped = Dropped} = MQ) -> [{len, len(MQ)}, {max_len, MaxLen}, {dropped, Dropped}]. %% @doc Enqueue a message. --spec(in(message(), mqueue()) -> {undefined | message(), mqueue()}). +-spec(in(message(), mqueue()) -> {maybe(message()), mqueue()}). in(#message{qos = ?QOS_0}, MQ = #mqueue{store_qos0 = false}) -> {_Dropped = undefined, MQ}; in(Msg = #message{topic = Topic}, MQ = #mqueue{default_p = Dp, diff --git a/src/emqx_packet.erl b/src/emqx_packet.erl index e9c2fa0df..0224c239a 100644 --- a/src/emqx_packet.erl +++ b/src/emqx_packet.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_pd.erl b/src/emqx_pd.erl index ce1e7723c..12603ef38 100644 --- a/src/emqx_pd.erl +++ b/src/emqx_pd.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -15,11 +15,13 @@ %% @doc The utility functions for erlang process dictionary. -module(emqx_pd). +-include("types.hrl"). + -export([update_counter/2, get_counter/1, reset_counter/1]). -type(key() :: term()). --spec(update_counter(key(), number()) -> undefined | number()). +-spec(update_counter(key(), number()) -> maybe(number())). update_counter(Key, Inc) -> put(Key, get_counter(Key) + Inc). diff --git a/src/emqx_plugins.erl b/src/emqx_plugins.erl index ea3190a35..8a958db5a 100644 --- a/src/emqx_plugins.erl +++ b/src/emqx_plugins.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_pmon.erl b/src/emqx_pmon.erl index a00212ed5..a16154dce 100644 --- a/src/emqx_pmon.erl +++ b/src/emqx_pmon.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_pool.erl b/src/emqx_pool.erl index e90cdda6b..6f952db72 100644 --- a/src/emqx_pool.erl +++ b/src/emqx_pool.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -17,6 +17,7 @@ -behaviour(gen_server). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/2]). -export([submit/1, submit/2]). @@ -34,7 +35,7 @@ -type(task() :: fun() | mfa() | {fun(), Args :: list(any())}). %% @doc Start pool. --spec(start_link(atom(), pos_integer()) -> emqx_types:startlink_ret()). +-spec(start_link(atom(), pos_integer()) -> startlink_ret()). start_link(Pool, Id) -> gen_server:start_link({local, emqx_misc:proc_name(?MODULE, Id)}, ?MODULE, [Pool, Id], [{hibernate_after, 1000}]). diff --git a/src/emqx_pool_sup.erl b/src/emqx_pool_sup.erl index 58a6a08cd..aebf48c20 100644 --- a/src/emqx_pool_sup.erl +++ b/src/emqx_pool_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_protocol.erl b/src/emqx_protocol.erl index 9b9ef7f7d..fad3c6f1a 100644 --- a/src/emqx_protocol.erl +++ b/src/emqx_protocol.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_rate_limiter.erl b/src/emqx_rate_limiter.erl index c8145dbbc..c01af7eda 100644 --- a/src/emqx_rate_limiter.erl +++ b/src/emqx_rate_limiter.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_reason_codes.erl b/src/emqx_reason_codes.erl index 5b7f7e42f..6797da59d 100644 --- a/src/emqx_reason_codes.erl +++ b/src/emqx_reason_codes.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_router.erl b/src/emqx_router.erl index 6989d90a6..224a14e48 100644 --- a/src/emqx_router.erl +++ b/src/emqx_router.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -18,6 +18,7 @@ -include("emqx.hrl"). -include("logger.hrl"). +-include("types.hrl"). -include_lib("ekka/include/ekka.hrl"). %% Mnesia bootstrap @@ -65,7 +66,7 @@ mnesia(copy) -> %% Start a router %%------------------------------------------------------------------------------ --spec(start_link(atom(), pos_integer()) -> emqx_types:startlink_ret()). +-spec(start_link(atom(), pos_integer()) -> startlink_ret()). start_link(Pool, Id) -> gen_server:start_link({local, emqx_misc:proc_name(?MODULE, Id)}, ?MODULE, [Pool, Id], [{hibernate_after, 1000}]). diff --git a/src/emqx_router_helper.erl b/src/emqx_router_helper.erl index 9eaa501d2..9772f8050 100644 --- a/src/emqx_router_helper.erl +++ b/src/emqx_router_helper.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -18,6 +18,7 @@ -include("emqx.hrl"). -include("logger.hrl"). +-include("types.hrl"). %% Mnesia bootstrap -export([mnesia/1]). @@ -61,7 +62,7 @@ mnesia(copy) -> %%------------------------------------------------------------------------------ %% @doc Starts the router helper --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). diff --git a/src/emqx_router_sup.erl b/src/emqx_router_sup.erl index 945d7910f..486d44b69 100644 --- a/src/emqx_router_sup.erl +++ b/src/emqx_router_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_rpc.erl b/src/emqx_rpc.erl index d4433bf6c..0245da838 100644 --- a/src/emqx_rpc.erl +++ b/src/emqx_rpc.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2013-2019 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. diff --git a/src/emqx_sequence.erl b/src/emqx_sequence.erl index 33bb5edda..4c25108ea 100644 --- a/src/emqx_sequence.erl +++ b/src/emqx_sequence.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_session.erl b/src/emqx_session.erl index 689d84b29..06d026e8c 100644 --- a/src/emqx_session.erl +++ b/src/emqx_session.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -43,6 +43,7 @@ -include("emqx.hrl"). -include("emqx_mqtt.hrl"). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/1]). -export([info/1, attrs/1]). @@ -77,7 +78,7 @@ client_id :: binary(), %% Username - username :: binary() | undefined, + username :: maybe(binary()), %% Connection pid binding with session conn_pid :: pid(), @@ -107,7 +108,7 @@ retry_interval = 20000 :: timeout(), %% Retry Timer - retry_timer :: reference() | undefined, + retry_timer :: maybe(reference()), %% All QoS1, QoS2 messages published to when client is disconnected. %% QoS 1 and QoS 2 messages pending transmission to the Client. @@ -125,19 +126,19 @@ await_rel_timeout = 20000 :: timeout(), %% Awaiting PUBREL Timer - await_rel_timer :: reference() | undefined, + await_rel_timer :: maybe(reference()), %% Session Expiry Interval expiry_interval = 7200 :: timeout(), %% Expired Timer - expiry_timer :: reference() | undefined, + expiry_timer :: maybe(reference()), %% Enable Stats enable_stats :: boolean(), %% Stats timer - stats_timer :: reference() | undefined, + stats_timer :: maybe(reference()), %% GC State gc_state, @@ -147,7 +148,7 @@ will_msg :: emqx:message(), - will_delay_timer :: reference() | undefined + will_delay_timer :: maybe(reference()) }). diff --git a/src/emqx_session_sup.erl b/src/emqx_session_sup.erl index aa430ced9..3e360794d 100644 --- a/src/emqx_session_sup.erl +++ b/src/emqx_session_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -17,6 +17,7 @@ -behaviour(gen_server). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/1]). -export([start_session/1, count_sessions/0]). @@ -38,7 +39,7 @@ -define(BATCH_EXIT, 100000). %% @doc Start session supervisor. --spec(start_link(map()) -> emqx_types:startlink_ret()). +-spec(start_link(map()) -> startlink_ret()). start_link(SessSpec) when is_map(SessSpec) -> gen_server:start_link({local, ?SUP}, ?MODULE, [SessSpec], []). @@ -47,7 +48,7 @@ start_link(SessSpec) when is_map(SessSpec) -> %%------------------------------------------------------------------------------ %% @doc Start a session. --spec(start_session(map()) -> emqx_types:startlink_ret()). +-spec(start_session(map()) -> startlink_ret()). start_session(SessAttrs) -> gen_server:call(?SUP, {start_session, SessAttrs}, infinity). diff --git a/src/emqx_shared_sub.erl b/src/emqx_shared_sub.erl index e14963bc7..5c4b46217 100644 --- a/src/emqx_shared_sub.erl +++ b/src/emqx_shared_sub.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -19,6 +19,7 @@ -include("emqx.hrl"). -include("emqx_mqtt.hrl"). -include("logger.hrl"). +-include("types.hrl"). %% Mnesia bootstrap -export([mnesia/1]). @@ -70,7 +71,7 @@ mnesia(copy) -> %% API %%------------------------------------------------------------------------------ --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). diff --git a/src/emqx_sm.erl b/src/emqx_sm.erl index dcbe9028e..2feb42433 100644 --- a/src/emqx_sm.erl +++ b/src/emqx_sm.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -18,6 +18,7 @@ -include("emqx.hrl"). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/0]). @@ -55,7 +56,7 @@ -define(BATCH_SIZE, 100000). --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?SM}, ?MODULE, [], []). diff --git a/src/emqx_sm_locker.erl b/src/emqx_sm_locker.erl index 409331b88..b7361f102 100644 --- a/src/emqx_sm_locker.erl +++ b/src/emqx_sm_locker.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -15,13 +15,14 @@ -module(emqx_sm_locker). -include("emqx.hrl"). +-include("types.hrl"). -export([start_link/0]). -export([trans/2, trans/3]). -export([lock/1, lock/2, unlock/1]). --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> ekka_locker:start_link(?MODULE). @@ -29,7 +30,7 @@ start_link() -> trans(ClientId, Fun) -> trans(ClientId, Fun, undefined). --spec(trans(emqx_types:client_id() | undefined, +-spec(trans(maybe(emqx_types:client_id()), fun(([node()])-> any()), ekka_locker:piggyback()) -> any()). trans(undefined, Fun, _Piggyback) -> Fun([]); diff --git a/src/emqx_sm_registry.erl b/src/emqx_sm_registry.erl index 327be77c1..d2aede1ed 100644 --- a/src/emqx_sm_registry.erl +++ b/src/emqx_sm_registry.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -18,6 +18,7 @@ -include("emqx.hrl"). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/0]). -export([is_enabled/0]). @@ -36,7 +37,7 @@ -type(session_pid() :: pid()). %% @doc Start the global session manager. --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?REGISTRY}, ?MODULE, [], []). diff --git a/src/emqx_sm_sup.erl b/src/emqx_sm_sup.erl index ed491c67f..65702b26f 100644 --- a/src/emqx_sm_sup.erl +++ b/src/emqx_sm_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_stats.erl b/src/emqx_stats.erl index d86886c28..a7cbbb314 100644 --- a/src/emqx_stats.erl +++ b/src/emqx_stats.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -18,6 +18,7 @@ -include("emqx.hrl"). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/0, start_link/1, stop/0]). @@ -82,11 +83,11 @@ -type opts() :: #{tick_ms := timeout()}. %% @doc Start stats server --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> start_link(#{tick_ms => timer:seconds(1)}). --spec(start_link(opts()) -> emqx_types:startlink_ret()). +-spec(start_link(opts()) -> startlink_ret()). start_link(Opts) -> gen_server:start_link({local, ?SERVER}, ?MODULE, Opts, []). @@ -112,7 +113,7 @@ getstats() -> end. %% @doc Get stats by name --spec(getstat(atom()) -> non_neg_integer() | undefined). +-spec(getstat(atom()) -> maybe(non_neg_integer())). getstat(Name) -> case ets:lookup(?TAB, Name) of [{Name, Val}] -> Val; diff --git a/src/emqx_sup.erl b/src/emqx_sup.erl index 60be4db87..5f62df904 100644 --- a/src/emqx_sup.erl +++ b/src/emqx_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_sys.erl b/src/emqx_sys.erl index d2fc3f546..ae80ae60e 100644 --- a/src/emqx_sys.erl +++ b/src/emqx_sys.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_sys_mon.erl b/src/emqx_sys_mon.erl index 0a36cae65..44a256f3f 100644 --- a/src/emqx_sys_mon.erl +++ b/src/emqx_sys_mon.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -17,6 +17,7 @@ -behavior(gen_server). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/1]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, @@ -24,10 +25,16 @@ %% compress unused warning -export([procinfo/1]). +-type(option() :: {long_gc, false | pos_integer()} + | {long_schedule, false | pos_integer()} + | {large_heap, pos_integer()} + | {busy_port, boolean()} + | {busy_dist_port, boolean()}). + -define(SYSMON, ?MODULE). %% @doc Start system monitor --spec(start_link(Opts :: list(tuple())) -> emqx_types:startlink_ret()). +-spec(start_link(list(option())) -> startlink_ret()). start_link(Opts) -> gen_server:start_link({local, ?SYSMON}, ?MODULE, [Opts], []). diff --git a/src/emqx_sys_sup.erl b/src/emqx_sys_sup.erl index b450ddd66..24609acdb 100644 --- a/src/emqx_sys_sup.erl +++ b/src/emqx_sys_sup.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_tables.erl b/src/emqx_tables.erl index fdb106a99..837a9d3e9 100644 --- a/src/emqx_tables.erl +++ b/src/emqx_tables.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_time.erl b/src/emqx_time.erl index a7edf7efb..60787fa37 100644 --- a/src/emqx_time.erl +++ b/src/emqx_time.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_topic.erl b/src/emqx_topic.erl index f7e229a13..2a37a873d 100644 --- a/src/emqx_topic.erl +++ b/src/emqx_topic.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_tracer.erl b/src/emqx_tracer.erl index d92cb4a1f..e88442f61 100644 --- a/src/emqx_tracer.erl +++ b/src/emqx_tracer.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -151,4 +151,4 @@ filter_by_meta_key(#{meta:=Meta}=LogEvent, {MetaKey, MetaValue}) -> false -> ignore end; _ -> ignore - end. \ No newline at end of file + end. diff --git a/src/emqx_trie.erl b/src/emqx_trie.erl index a892b1fc2..9b9436ce0 100644 --- a/src/emqx_trie.erl +++ b/src/emqx_trie.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_types.erl b/src/emqx_types.erl index 960aa699a..d84b1099a 100644 --- a/src/emqx_types.erl +++ b/src/emqx_types.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -15,9 +15,9 @@ -module(emqx_types). -include("emqx.hrl"). +-include("types.hrl"). -export_type([zone/0]). --export_type([startlink_ret/0, ok_or_error/1]). -export_type([pubsub/0, topic/0, subid/0, subopts/0]). -export_type([client_id/0, username/0, password/0, peername/0, protocol/0]). -export_type([credentials/0, session/0]). @@ -28,8 +28,6 @@ -export_type([alarm/0, plugin/0, command/0]). -type(zone() :: atom()). --type(startlink_ret() :: {ok, pid()} | ignore | {error, term()}). --type(ok_or_error(Reason) :: ok | {error, Reason}). -type(pubsub() :: publish | subscribe). -type(topic() :: binary()). -type(subid() :: binary() | atom()). @@ -39,8 +37,8 @@ }). -type(session() :: #session{}). -type(client_id() :: binary() | atom()). --type(username() :: binary() | undefined). --type(password() :: binary() | undefined). +-type(username() :: maybe(binary())). +-type(password() :: maybe(binary())). -type(peername() :: {inet:ip_address(), inet:port_number()}). -type(protocol() :: mqtt | 'mqtt-sn' | coap | stomp | none | atom()). -type(credentials() :: #{client_id := client_id(), diff --git a/src/emqx_vm.erl b/src/emqx_vm.erl index 15ae00689..85019d8c5 100644 --- a/src/emqx_vm.erl +++ b/src/emqx_vm.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/src/emqx_ws_connection.erl b/src/emqx_ws_connection.erl index 69a3849fe..fec52995f 100644 --- a/src/emqx_ws_connection.erl +++ b/src/emqx_ws_connection.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -189,7 +189,15 @@ websocket_handle({binary, Data}, State = #state{parser_state = ParserState, _:Error -> ?LOG(error, "Frame error:~p~nFrame data: ~p", [Error, Data]), shutdown(parse_error, State) - end. + end; +%% Pings should be replied with pongs, cowboy does it automatically +%% Pongs can be safely ignored. Clause here simply prevents crash. +websocket_handle(Frame, State) + when Frame =:= ping; Frame =:= pong -> + {ok, ensure_stats_timer(State)}; +websocket_handle({FrameType, _}, State) + when FrameType =:= ping; FrameType =:= pong -> + {ok, ensure_stats_timer(State)}. websocket_info({call, From, info}, State) -> gen_server:reply(From, info(State)), diff --git a/src/emqx_zone.erl b/src/emqx_zone.erl index 890d14a89..522da1271 100644 --- a/src/emqx_zone.erl +++ b/src/emqx_zone.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -18,6 +18,7 @@ -include("emqx.hrl"). -include("logger.hrl"). +-include("types.hrl"). -export([start_link/0]). -export([get_env/2, get_env/3]). @@ -33,17 +34,17 @@ -define(TAB, ?MODULE). -define(SERVER, ?MODULE). --spec(start_link() -> emqx_types:startlink_ret()). +-spec(start_link() -> startlink_ret()). start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). --spec(get_env(emqx_types:zone() | undefined, atom()) -> undefined | term()). +-spec(get_env(maybe(emqx_types:zone()), atom()) -> maybe(term())). get_env(undefined, Key) -> emqx_config:get_env(Key); get_env(Zone, Key) -> get_env(Zone, Key, undefined). --spec(get_env(emqx_types:zone() | undefined, atom(), term()) -> undefined | term()). +-spec(get_env(maybe(emqx_types:zone()), atom(), term()) -> maybe(term())). get_env(undefined, Key, Def) -> emqx_config:get_env(Key, Def); get_env(Zone, Key, Def) -> diff --git a/test/emqx_SUITE.erl b/test/emqx_SUITE.erl index c6bea732a..1c591b404 100644 --- a/test/emqx_SUITE.erl +++ b/test/emqx_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_access_SUITE.erl b/test/emqx_access_SUITE.erl index b49c90d80..60f709ee5 100644 --- a/test/emqx_access_SUITE.erl +++ b/test/emqx_access_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_acl_test_mod.erl b/test/emqx_acl_test_mod.erl index 131336cdd..343202a96 100644 --- a/test/emqx_acl_test_mod.erl +++ b/test/emqx_acl_test_mod.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_auth_anonymous_test_mod.erl b/test/emqx_auth_anonymous_test_mod.erl index e04841feb..60ee4ad5f 100644 --- a/test/emqx_auth_anonymous_test_mod.erl +++ b/test/emqx_auth_anonymous_test_mod.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_auth_dashboard.erl b/test/emqx_auth_dashboard.erl index b8c742d3b..00c8bdec5 100644 --- a/test/emqx_auth_dashboard.erl +++ b/test/emqx_auth_dashboard.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_banned_SUITE.erl b/test/emqx_banned_SUITE.erl index 7e7434e61..bf7c9908a 100644 --- a/test/emqx_banned_SUITE.erl +++ b/test/emqx_banned_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_batch_SUITE.erl b/test/emqx_batch_SUITE.erl index c4c69080b..277459cfe 100644 --- a/test/emqx_batch_SUITE.erl +++ b/test/emqx_batch_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_bridge_SUITE.erl b/test/emqx_bridge_SUITE.erl index bd2894101..9681c27e6 100644 --- a/test/emqx_bridge_SUITE.erl +++ b/test/emqx_bridge_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_broker_SUITE.erl b/test/emqx_broker_SUITE.erl index b2031a61c..81796dbdc 100644 --- a/test/emqx_broker_SUITE.erl +++ b/test/emqx_broker_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_client_SUITE.erl b/test/emqx_client_SUITE.erl index 13303bfdc..7b86f851c 100644 --- a/test/emqx_client_SUITE.erl +++ b/test/emqx_client_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_cm_SUITE.erl b/test/emqx_cm_SUITE.erl index 3d879a476..a64c8139a 100644 --- a/test/emqx_cm_SUITE.erl +++ b/test/emqx_cm_SUITE.erl @@ -1,5 +1,5 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_connection_SUITE.erl b/test/emqx_connection_SUITE.erl index 769f8df1f..aca650215 100644 --- a/test/emqx_connection_SUITE.erl +++ b/test/emqx_connection_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_ct_broker_helpers.erl b/test/emqx_ct_broker_helpers.erl index c1433c203..1ab79e8a9 100644 --- a/test/emqx_ct_broker_helpers.erl +++ b/test/emqx_ct_broker_helpers.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -56,6 +56,7 @@ run_setup_steps() -> NewConfig = generate_config(), lists:foreach(fun set_app_env/1, NewConfig), + set_bridge_env(), application:ensure_all_started(?APP). run_teardown_steps() -> @@ -88,6 +89,10 @@ set_app_env({App, Lists}) -> application:set_env(App, Par, Var) end, Lists). +set_bridge_env() -> + BridgeEnvs = bridge_conf(), + application:set_env(?APP, bridges, BridgeEnvs). + change_opts(SslType) -> {ok, Listeners} = application:get_env(?APP, listeners), NewListeners = @@ -148,4 +153,27 @@ flush(Msgs) -> M -> flush([M|Msgs]) after 0 -> lists:reverse(Msgs) - end. \ No newline at end of file + end. + +bridge_conf() -> + [{aws, + [{username,"user"}, + {address,"127.0.0.1:1883"}, + {clean_start,true}, + {client_id,"bridge_aws"}, + {forwards,["topic1/#","topic2/#"]}, + {keepalive,60000}, + {max_inflight,32}, + {mountpoint,"bridge/aws/${node}/"}, + {password,"passwd"}, + {proto_ver,mqttv4}, + {queue, + #{batch_size => 1000,mem_cache => true, + replayq_dir => "data/emqx_aws_bridge/", + replayq_seg_bytes => 10485760}}, + {reconnect_interval,30000}, + {retry_interval,20000}, + {ssl,false}, + {ssl_opts,[{versions,[tlsv1,'tlsv1.1','tlsv1.2']}]}, + {start_type,manual}, + {subscriptions,[{"cmd/topic1",1},{"cmd/topic2",1}]}]}]. \ No newline at end of file diff --git a/test/emqx_ct_helpers.erl b/test/emqx_ct_helpers.erl index c61c5be6e..eae22d6ab 100644 --- a/test/emqx_ct_helpers.erl +++ b/test/emqx_ct_helpers.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_frame_SUITE.erl b/test/emqx_frame_SUITE.erl index a4e64c7d0..86505a566 100644 --- a/test/emqx_frame_SUITE.erl +++ b/test/emqx_frame_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_gc_SUITE.erl b/test/emqx_gc_SUITE.erl index 22d7cd584..e75cb2320 100644 --- a/test/emqx_gc_SUITE.erl +++ b/test/emqx_gc_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_guid_SUITE.erl b/test/emqx_guid_SUITE.erl index cb2e6543c..f412138ad 100644 --- a/test/emqx_guid_SUITE.erl +++ b/test/emqx_guid_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_hooks_SUITE.erl b/test/emqx_hooks_SUITE.erl index 1961d0e02..864a3ab96 100644 --- a/test/emqx_hooks_SUITE.erl +++ b/test/emqx_hooks_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_inflight_SUITE.erl b/test/emqx_inflight_SUITE.erl index 5e504f4f8..d0373e11b 100644 --- a/test/emqx_inflight_SUITE.erl +++ b/test/emqx_inflight_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_json_SUITE.erl b/test/emqx_json_SUITE.erl index 980d29703..ccdce1cd2 100644 --- a/test/emqx_json_SUITE.erl +++ b/test/emqx_json_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_keepalive_SUITE.erl b/test/emqx_keepalive_SUITE.erl index c4dbd80f2..a60383b01 100644 --- a/test/emqx_keepalive_SUITE.erl +++ b/test/emqx_keepalive_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_lib_SUITE.erl b/test/emqx_lib_SUITE.erl index 12bbd023e..1d7e1f31f 100644 --- a/test/emqx_lib_SUITE.erl +++ b/test/emqx_lib_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_listeners_SUITE.erl b/test/emqx_listeners_SUITE.erl index 17181aa31..d969699bc 100644 --- a/test/emqx_listeners_SUITE.erl +++ b/test/emqx_listeners_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_message_SUITE.erl b/test/emqx_message_SUITE.erl index 3bb06d14c..9bf862af3 100644 --- a/test/emqx_message_SUITE.erl +++ b/test/emqx_message_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_metrics_SUITE.erl b/test/emqx_metrics_SUITE.erl index ead7e98ba..ff9dee8c1 100644 --- a/test/emqx_metrics_SUITE.erl +++ b/test/emqx_metrics_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_misc_tests.erl b/test/emqx_misc_tests.erl index 92b0973e8..d0da45fba 100644 --- a/test/emqx_misc_tests.erl +++ b/test/emqx_misc_tests.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_mock_client.erl b/test/emqx_mock_client.erl index 36d743ef9..7de80ad4a 100644 --- a/test/emqx_mock_client.erl +++ b/test/emqx_mock_client.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_mod_SUITE.erl b/test/emqx_mod_SUITE.erl index 44376f7b7..39d9abc21 100644 --- a/test/emqx_mod_SUITE.erl +++ b/test/emqx_mod_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_mod_rewrite_tests.erl b/test/emqx_mod_rewrite_tests.erl index 6fea7ee71..bc41977c3 100644 --- a/test/emqx_mod_rewrite_tests.erl +++ b/test/emqx_mod_rewrite_tests.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_mod_sup_SUITE.erl b/test/emqx_mod_sup_SUITE.erl index 29b59d0b8..85fa6af78 100644 --- a/test/emqx_mod_sup_SUITE.erl +++ b/test/emqx_mod_sup_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_mountpoint_SUITE.erl b/test/emqx_mountpoint_SUITE.erl index a77baf751..8db5805b0 100644 --- a/test/emqx_mountpoint_SUITE.erl +++ b/test/emqx_mountpoint_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_mqtt_caps_SUITE.erl b/test/emqx_mqtt_caps_SUITE.erl index 26e343ca6..e07158e72 100644 --- a/test/emqx_mqtt_caps_SUITE.erl +++ b/test/emqx_mqtt_caps_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_mqtt_packet_SUITE.erl b/test/emqx_mqtt_packet_SUITE.erl index 4386ff02e..3be2617b0 100644 --- a/test/emqx_mqtt_packet_SUITE.erl +++ b/test/emqx_mqtt_packet_SUITE.erl @@ -1,5 +1,5 @@ %%%=================================================================== -%%% Copyright (c) 2013-2018 EMQ Inc. All rights reserved. +%%% Copyright (c) 2013-2013-2019 EMQ Inc. 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. diff --git a/test/emqx_mqtt_props_SUITE.erl b/test/emqx_mqtt_props_SUITE.erl index 8d3b16a14..09a2611f7 100644 --- a/test/emqx_mqtt_props_SUITE.erl +++ b/test/emqx_mqtt_props_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_mqueue_SUITE.erl b/test/emqx_mqueue_SUITE.erl index 9bb424fa1..8a97ec108 100644 --- a/test/emqx_mqueue_SUITE.erl +++ b/test/emqx_mqueue_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_net_SUITE.erl b/test/emqx_net_SUITE.erl index 50a830d10..47695043b 100644 --- a/test/emqx_net_SUITE.erl +++ b/test/emqx_net_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_packet_SUITE.erl b/test/emqx_packet_SUITE.erl index 7758da86e..4cb87bd18 100644 --- a/test/emqx_packet_SUITE.erl +++ b/test/emqx_packet_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_pd_SUITE.erl b/test/emqx_pd_SUITE.erl index e53fa7539..80b203392 100644 --- a/test/emqx_pd_SUITE.erl +++ b/test/emqx_pd_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_pmon_SUITE.erl b/test/emqx_pmon_SUITE.erl index 67e8cf4d7..6b2170282 100644 --- a/test/emqx_pmon_SUITE.erl +++ b/test/emqx_pmon_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_pool_SUITE.erl b/test/emqx_pool_SUITE.erl index 72fe51ec0..ea648709f 100644 --- a/test/emqx_pool_SUITE.erl +++ b/test/emqx_pool_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_pqueue_SUITE.erl b/test/emqx_pqueue_SUITE.erl index 9efccf472..31d3fefd3 100644 --- a/test/emqx_pqueue_SUITE.erl +++ b/test/emqx_pqueue_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_protocol_SUITE.erl b/test/emqx_protocol_SUITE.erl index fc96cc839..e48825d76 100644 --- a/test/emqx_protocol_SUITE.erl +++ b/test/emqx_protocol_SUITE.erl @@ -1,5 +1,5 @@ %%-------------------------------------------------------------------- -%% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io) +%% Copyright (c) 2013-2013-2019 EMQ Enterprise, Inc. (http://emqtt.io) %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/test/emqx_protocol_tests.erl b/test/emqx_protocol_tests.erl index 56b65e36a..acadfe79d 100644 --- a/test/emqx_protocol_tests.erl +++ b/test/emqx_protocol_tests.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_reason_codes_tests.erl b/test/emqx_reason_codes_tests.erl index a8e352c83..bf38a451e 100644 --- a/test/emqx_reason_codes_tests.erl +++ b/test/emqx_reason_codes_tests.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_router_SUITE.erl b/test/emqx_router_SUITE.erl index 9174c258a..3a1b77e27 100644 --- a/test/emqx_router_SUITE.erl +++ b/test/emqx_router_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_sequence_SUITE.erl b/test/emqx_sequence_SUITE.erl index ab408b8e0..7b95c0c67 100644 --- a/test/emqx_sequence_SUITE.erl +++ b/test/emqx_sequence_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_session_SUITE.erl b/test/emqx_session_SUITE.erl index b8e0aedd3..54b2e8579 100644 --- a/test/emqx_session_SUITE.erl +++ b/test/emqx_session_SUITE.erl @@ -1,5 +1,5 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_shared_sub_SUITE.erl b/test/emqx_shared_sub_SUITE.erl index cc5a5f515..1ee059812 100644 --- a/test/emqx_shared_sub_SUITE.erl +++ b/test/emqx_shared_sub_SUITE.erl @@ -1,5 +1,5 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_sm_SUITE.erl b/test/emqx_sm_SUITE.erl index 3d1db5ddc..2985bc823 100644 --- a/test/emqx_sm_SUITE.erl +++ b/test/emqx_sm_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_stats_tests.erl b/test/emqx_stats_tests.erl index e8b5e82af..7170c422b 100644 --- a/test/emqx_stats_tests.erl +++ b/test/emqx_stats_tests.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_sys_mon_SUITE.erl b/test/emqx_sys_mon_SUITE.erl index e2e9fe2ad..53b6cebfd 100644 --- a/test/emqx_sys_mon_SUITE.erl +++ b/test/emqx_sys_mon_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_tables_SUITE.erl b/test/emqx_tables_SUITE.erl index 1002c0a0b..c282e93af 100644 --- a/test/emqx_tables_SUITE.erl +++ b/test/emqx_tables_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_time_SUITE.erl b/test/emqx_time_SUITE.erl index 470b9dfe7..4c8886f9c 100644 --- a/test/emqx_time_SUITE.erl +++ b/test/emqx_time_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_topic_SUITE.erl b/test/emqx_topic_SUITE.erl index 8ce3faf79..2ad57154d 100644 --- a/test/emqx_topic_SUITE.erl +++ b/test/emqx_topic_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_tracer_SUITE.erl b/test/emqx_tracer_SUITE.erl index d1a3bfa5e..323700823 100644 --- a/test/emqx_tracer_SUITE.erl +++ b/test/emqx_tracer_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. @@ -71,4 +71,4 @@ start_traces(_Config) -> ok = emqx_tracer:stop_trace({topic, <<"a/#">>}), emqx_client:disconnect(T), - emqx_logger:set_log_level(error). \ No newline at end of file + emqx_logger:set_log_level(error). diff --git a/test/emqx_trie_SUITE.erl b/test/emqx_trie_SUITE.erl index f10d13d0a..ad92cb313 100644 --- a/test/emqx_trie_SUITE.erl +++ b/test/emqx_trie_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_vm_SUITE.erl b/test/emqx_vm_SUITE.erl index 91744764e..650f792ab 100644 --- a/test/emqx_vm_SUITE.erl +++ b/test/emqx_vm_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_ws_connection_SUITE.erl b/test/emqx_ws_connection_SUITE.erl index dd7b17f3e..c3698861b 100644 --- a/test/emqx_ws_connection_SUITE.erl +++ b/test/emqx_ws_connection_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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. diff --git a/test/emqx_zone_SUITE.erl b/test/emqx_zone_SUITE.erl index 83c2ceaab..23ef3c67d 100644 --- a/test/emqx_zone_SUITE.erl +++ b/test/emqx_zone_SUITE.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved. +%% Copyright (c) 2013-2019 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.