Merge pull request #1477 from emqtt/develop

Version 2.3.4
This commit is contained in:
huangdan 2018-01-28 22:24:42 +08:00 committed by GitHub
commit 25557c9f22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
93 changed files with 243 additions and 130 deletions

View File

@ -1,6 +1,6 @@
PROJECT = emqttd PROJECT = emqttd
PROJECT_DESCRIPTION = Erlang MQTT Broker PROJECT_DESCRIPTION = Erlang MQTT Broker
PROJECT_VERSION = 2.3.3 PROJECT_VERSION = 2.3.4
DEPS = goldrush gproc lager esockd ekka mochiweb pbkdf2 lager_syslog bcrypt clique jsx DEPS = goldrush gproc lager esockd ekka mochiweb pbkdf2 lager_syslog bcrypt clique jsx

View File

@ -231,6 +231,15 @@ node.fullsweep_after = 1000
## Value: Log file ## Value: Log file
node.crash_dump = {{ platform_log_dir }}/crash.dump node.crash_dump = {{ platform_log_dir }}/crash.dump
## Specify the erlang distributed protocol.
##
## Value: Enum
## - inet_tcp: the default; handles TCP streams with IPv4 addressing.
## - inet6_tcp: handles TCP with IPv6 addressing.
##
## vm.args: -proto_dist inet_tcp
node.proto_dist = inet_tcp
## Sets the net_kernel tick time. TickTime is specified in seconds. ## Sets the net_kernel tick time. TickTime is specified in seconds.
## Notice that all communicating nodes are to have the same TickTime ## Notice that all communicating nodes are to have the same TickTime
## value specified. ## value specified.
@ -695,6 +704,11 @@ listener.tcp.external.tune_buffer = on
## Value: true | false ## Value: true | false
listener.tcp.external.nodelay = true listener.tcp.external.nodelay = true
## The SO_REUSEADDR flag for TCP listener.
##
## Value: true | false
listener.tcp.external.reuseaddr = true
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## Internal TCP Listener for MQTT Protocol ## Internal TCP Listener for MQTT Protocol
@ -791,6 +805,11 @@ listener.tcp.internal.tune_buffer = on
## Value: true | false ## Value: true | false
listener.tcp.internal.nodelay = false listener.tcp.internal.nodelay = false
## The SO_REUSEADDR flag for MQTT/TCP Listener.
##
## Value: true | false
listener.tcp.internal.reuseaddr = true
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## MQTT/SSL - External SSL Listener for MQTT Protocol ## MQTT/SSL - External SSL Listener for MQTT Protocol
@ -1020,10 +1039,15 @@ listener.ssl.external.certfile = {{ platform_etc_dir }}/certs/cert.pem
## Value: true | false ## Value: true | false
## listener.ssl.external.nodelay = true ## listener.ssl.external.nodelay = true
## The SO_REUSEADDR flag for MQTT/SSL Listener.
##
## Value: true | false
listener.ssl.external.reuseaddr = true
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## External WebSocket Listener for MQTT Protocol ## External WebSocket Listener for MQTT Protocol
## listener.ws.<name> is the IP address and port that the MQTT/Websocket ## listener.ws.<name> is the IP address and port that the MQTT/WebSocket
## listener will bind. ## listener will bind.
## ##
## Value: IP:Port | Port ## Value: IP:Port | Port
@ -1031,35 +1055,47 @@ listener.ssl.external.certfile = {{ platform_etc_dir }}/certs/cert.pem
## Examples: 8083, 127.0.0.1:8083, ::1:8083 ## Examples: 8083, 127.0.0.1:8083, ::1:8083
listener.ws.external = 8083 listener.ws.external = 8083
## The acceptor pool for external MQTT/Websocket listener. ## The acceptor pool for external MQTT/WebSocket listener.
## ##
## Value: Number ## Value: Number
listener.ws.external.acceptors = 4 listener.ws.external.acceptors = 4
## Maximum number of concurrent MQTT/Websocket connections. ## Maximum number of concurrent MQTT/WebSocket connections.
## ##
## Value: Number ## Value: Number
listener.ws.external.max_clients = 102400 listener.ws.external.max_clients = 102400
## TODO: Zone of the external MQTT/Websocket listener belonged to. ## TODO: Zone of the external MQTT/WebSocket listener belonged to.
## ##
## Value: String ## Value: String
## listener.ws.external.zone = external ## listener.ws.external.zone = external
## Mountpoint of the MQTT/Websocket Listener. ## Mountpoint of the MQTT/WebSocket Listener.
## ##
## See: listener.tcp.<name>.mountpoint ## See: listener.tcp.<name>.mountpoint
## ##
## Value: String ## Value: String
## listener.ws.external.mountpoint = external/ ## listener.ws.external.mountpoint = external/
## The access control for the MQTT/Websocket listener. ## The access control for the MQTT/WebSocket listener.
## ##
## See: listener.tcp.<name>.access ## See: listener.tcp.<name>.access
## ##
## Value: ACL Rule ## Value: ACL Rule
listener.ws.external.access.1 = allow all listener.ws.external.access.1 = allow all
## Use X-Forwarded-For header for real source IP if the EMQ cluster is
## deployed behind NGINX or HAProxy.
##
## Value: String
## listener.ws.external.proxy_address_header = X-Forwarded-For
## Use X-Forwarded-Port header for real source port if the EMQ cluster is
## deployed behind NGINX or HAProxy.
##
## Value: String
## listener.ws.external.proxy_port_header = X-Forwarded-Port
## Enable the Proxy Protocol V1/2 if the EMQ cluster is deployed behind ## Enable the Proxy Protocol V1/2 if the EMQ cluster is deployed behind
## HAProxy or Nginx. ## HAProxy or Nginx.
## ##
@ -1075,37 +1111,37 @@ listener.ws.external.access.1 = allow all
## Value: Duration ## Value: Duration
## listener.ws.external.proxy_protocol_timeout = 3s ## listener.ws.external.proxy_protocol_timeout = 3s
## The TCP backlog of external MQTT/Websocket Listener. ## The TCP backlog of external MQTT/WebSocket Listener.
## ##
## See: listener.tcp.<name>.backlog ## See: listener.tcp.<name>.backlog
## ##
## Value: Number >= 0 ## Value: Number >= 0
listener.ws.external.backlog = 1024 listener.ws.external.backlog = 1024
## The TCP send timeout for external MQTT/Websocket connections. ## The TCP send timeout for external MQTT/WebSocket connections.
## ##
## See: listener.tcp.<name>.send_timeout ## See: listener.tcp.<name>.send_timeout
## ##
## Value: Duration ## Value: Duration
listener.ws.external.send_timeout = 15s listener.ws.external.send_timeout = 15s
## Close the MQTT/Websocket connection if send timeout. ## Close the MQTT/WebSocket connection if send timeout.
## ##
## See: listener.tcp.<name>.send_timeout_close ## See: listener.tcp.<name>.send_timeout_close
## ##
## Value: on | off ## Value: on | off
listener.ws.external.send_timeout_close = on listener.ws.external.send_timeout_close = on
## The TCP receive buffer(os kernel) for external MQTT/Websocket connections. ## The TCP receive buffer(os kernel) for external MQTT/WebSocket connections.
## ##
## See: listener.tcp.<name>.recbuf ## See: listener.tcp.<name>.recbuf
## ##
## Value: Bytes ## Value: Bytes
## listener.ws.external.recbuf = 4KB ## listener.ws.external.recbuf = 4KB
## The TCP send buffer(os kernel) for external MQTT/Websocket connections. ## The TCP send buffer(os kernel) for external MQTT/WebSocket connections.
## ##
## See 'listener.tcp.<name>.sndbuf' ## See: listener.tcp.<name>.sndbuf
## ##
## Value: Bytes ## Value: Bytes
## listener.ws.external.sndbuf = 4KB ## listener.ws.external.sndbuf = 4KB
@ -1124,17 +1160,22 @@ listener.ws.external.send_timeout_close = on
## Value: on | off ## Value: on | off
listener.ws.external.tune_buffer = on listener.ws.external.tune_buffer = on
## The TCP_NODELAY flag for external MQTT/Websocket connections. ## The TCP_NODELAY flag for external MQTT/WebSocket connections.
## ##
## See: listener.tcp.<name>.nodelay ## See: listener.tcp.<name>.nodelay
## ##
## Value: true | false ## Value: true | false
listener.ws.external.nodelay = true listener.ws.external.nodelay = true
## The SO_REUSEADDR flag for MQTT/WebSocket Listener.
##
## Value: true | false
listener.ws.external.reuseaddr = true
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## External WebSocket/SSL listener for MQTT Protocol ## External WebSocket/SSL listener for MQTT Protocol
## listener.wss.<name> is the IP address and port that the MQTT/Websocket/SSL ## listener.wss.<name> is the IP address and port that the MQTT/WebSocket/SSL
## listener will bind. ## listener will bind.
## ##
## Value: IP:Port | Port ## Value: IP:Port | Port
@ -1142,7 +1183,7 @@ listener.ws.external.nodelay = true
## Examples: 8084, 127.0.0.1:8084, ::1:8084 ## Examples: 8084, 127.0.0.1:8084, ::1:8084
listener.wss.external = 8084 listener.wss.external = 8084
## The acceptor pool for external MQTT/Websocket/SSL listener. ## The acceptor pool for external MQTT/WebSocket/SSL listener.
## ##
## Value: Number ## Value: Number
listener.wss.external.acceptors = 4 listener.wss.external.acceptors = 4
@ -1152,25 +1193,35 @@ listener.wss.external.acceptors = 4
## Value: Number ## Value: Number
listener.wss.external.max_clients = 64 listener.wss.external.max_clients = 64
## TODO: Zone of the external MQTT/Websocket/SSL listener belonged to. ## TODO: Zone of the external MQTT/WebSocket/SSL listener belonged to.
## ##
## Value: String ## Value: String
## listener.wss.external.zone = external ## listener.wss.external.zone = external
## Mountpoint of the MQTT/Websocket/SSL Listener. ## Mountpoint of the MQTT/WebSocket/SSL Listener.
## ##
## See 'listener.tcp.<name>.mountpoint' ## See: listener.tcp.<name>.mountpoint
## ##
## Value: String ## Value: String
## listener.wss.external.mountpoint = inbound/ ## listener.wss.external.mountpoint = inbound/
## The access control rules for the MQTT/Websocket/SSL listener. ## The access control rules for the MQTT/WebSocket/SSL listener.
## ##
## See: listener.tcp.<name>.access.<no> ## See: listener.tcp.<name>.access.<no>
## ##
## Value: ACL Rule ## Value: ACL Rule
listener.wss.external.access.1 = allow all listener.wss.external.access.1 = allow all
## See: listener.ws.external.proxy_address_header
##
## Value: String
## listener.wss.external.proxy_address_header = X-Forwarded-For
## See: listener.ws.external.proxy_port_header
##
## Value: String
## listener.wss.external.proxy_port_header = X-Forwarded-Port
## Enable the Proxy Protocol V1/2 support. ## Enable the Proxy Protocol V1/2 support.
## ##
## See: listener.tcp.<name>.proxy_protocol ## See: listener.tcp.<name>.proxy_protocol
@ -1260,35 +1311,35 @@ listener.wss.external.certfile = {{ platform_etc_dir }}/certs/cert.pem
## Value: cn | dn ## Value: cn | dn
## listener.wss.external.peer_cert_as_username = cn ## listener.wss.external.peer_cert_as_username = cn
## TCP backlog for the Websocket/SSL connection. ## TCP backlog for the WebSocket/SSL connection.
## ##
## See 'listener.tcp.<name>.backlog' ## See listener.tcp.<name>.backlog
## ##
## Value: Number >= 0 ## Value: Number >= 0
listener.wss.external.backlog = 1024 listener.wss.external.backlog = 1024
## The TCP send timeout for the Websocket/SSL connection. ## The TCP send timeout for the WebSocket/SSL connection.
## ##
## See 'listener.tcp.<name>.send_timeout' ## See: listener.tcp.<name>.send_timeout
## ##
## Value: Duration ## Value: Duration
listener.wss.external.send_timeout = 15s listener.wss.external.send_timeout = 15s
## Close the Websocket/SSL connection if send timeout. ## Close the WebSocket/SSL connection if send timeout.
## ##
## See: listener.tcp.<name>.send_timeout_close ## See: listener.tcp.<name>.send_timeout_close
## ##
## Value: on | off ## Value: on | off
listener.wss.external.send_timeout_close = on listener.wss.external.send_timeout_close = on
## The TCP receive buffer(os kernel) for the Websocket/SSL connections. ## The TCP receive buffer(os kernel) for the WebSocket/SSL connections.
## ##
## See: listener.tcp.<name>.recbuf ## See: listener.tcp.<name>.recbuf
## ##
## Value: Bytes ## Value: Bytes
## listener.wss.external.recbuf = 4KB ## listener.wss.external.recbuf = 4KB
## The TCP send buffer(os kernel) for the Websocket/SSL connections. ## The TCP send buffer(os kernel) for the WebSocket/SSL connections.
## ##
## See: listener.tcp.<name>.sndbuf ## See: listener.tcp.<name>.sndbuf
## ##
@ -1302,13 +1353,18 @@ listener.wss.external.send_timeout_close = on
## Value: Bytes ## Value: Bytes
## listener.wss.external.buffer = 4KB ## listener.wss.external.buffer = 4KB
## The TCP_NODELAY flag for Websocket/SSL connections. ## The TCP_NODELAY flag for WebSocket/SSL connections.
## ##
## See: listener.tcp.<name>.nodelay ## See: listener.tcp.<name>.nodelay
## ##
## Value: true | false ## Value: true | false
## listener.wss.external.nodelay = true ## listener.wss.external.nodelay = true
## The SO_REUSEADDR flag for WebSocket/SSL listener.
##
## Value: true | false
listener.wss.external.reuseaddr = true
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## HTTP Management API Listener ## HTTP Management API Listener

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.
@ -18,7 +18,7 @@
%% Banner %% Banner
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-define(COPYRIGHT, "Copyright (c) 2013-2017 EMQ Enterprise, Inc."). -define(COPYRIGHT, "Copyright (c) 2013-2018 EMQ Enterprise, Inc.").
-define(LICENSE_MESSAGE, "Licensed under the Apache License, Version 2.0"). -define(LICENSE_MESSAGE, "Licensed under the Apache License, Version 2.0").

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -168,6 +168,11 @@ end}.
{default, "emq@127.0.0.1"} {default, "emq@127.0.0.1"}
]}. ]}.
%% @doc The erlang distributed protocol
{mapping, "node.proto_dist", "vm_args.-proto_dist", [
%%{default, "inet_tcp"}
]}.
%% @doc Secret cookie for distributed erlang node %% @doc Secret cookie for distributed erlang node
{mapping, "node.cookie", "vm_args.-setcookie", [ {mapping, "node.cookie", "vm_args.-setcookie", [
{default, "emqsecretcookie"} {default, "emqsecretcookie"}
@ -400,7 +405,7 @@ end}.
{translation, {translation,
"lager.handlers", "lager.handlers",
fun(Conf) -> fun(Conf) ->
ErrorHandler = case cuttlefish:conf_get("log.error.file", Conf) of ErrorHandler = case cuttlefish:conf_get("log.error.file", Conf, undefined) of
undefined -> []; undefined -> [];
ErrorFilename -> [{lager_file_backend, [{file, ErrorFilename}, ErrorFilename -> [{lager_file_backend, [{file, ErrorFilename},
{level, error}, {level, error},
@ -442,7 +447,6 @@ end}.
cuttlefish:conf_get("log.syslog.facility", Conf), cuttlefish:conf_get("log.syslog.facility", Conf),
cuttlefish:conf_get("log.syslog.level", Conf)]}] cuttlefish:conf_get("log.syslog.level", Conf)]}]
end, end,
ConsoleHandlers ++ ErrorHandler ++ InfoHandler ++ SyslogHandler ConsoleHandlers ++ ErrorHandler ++ InfoHandler ++ SyslogHandler
end end
}. }.
@ -846,6 +850,11 @@ end}.
hidden hidden
]}. ]}.
{mapping, "listener.tcp.$name.reuseaddr", "emqttd.listeners", [
{datatype, {enum, [true, false]}},
hidden
]}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% SSL Listeners %% SSL Listeners
@ -928,6 +937,11 @@ end}.
hidden hidden
]}. ]}.
{mapping, "listener.ssl.$name.reuseaddr", "emqttd.listeners", [
{datatype, {enum, [true, false]}},
hidden
]}.
{mapping, "listener.ssl.$name.tls_versions", "emqttd.listeners", [ {mapping, "listener.ssl.$name.tls_versions", "emqttd.listeners", [
{datatype, string} {datatype, string}
]}. ]}.
@ -1015,6 +1029,16 @@ end}.
{datatype, string} {datatype, string}
]}. ]}.
{mapping, "listener.ws.$name.proxy_address_header", "emqttd.listeners", [
{datatype, string},
hidden
]}.
{mapping, "listener.ws.$name.proxy_port_header", "emqttd.listeners", [
{datatype, string},
hidden
]}.
{mapping, "listener.ws.$name.proxy_protocol", "emqttd.listeners", [ {mapping, "listener.ws.$name.proxy_protocol", "emqttd.listeners", [
{datatype, flag} {datatype, flag}
]}. ]}.
@ -1063,6 +1087,11 @@ end}.
hidden hidden
]}. ]}.
{mapping, "listener.ws.$name.reuseaddr", "emqttd.listeners", [
{datatype, {enum, [true, false]}},
hidden
]}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% MQTT/WebSocket/SSL Listeners %% MQTT/WebSocket/SSL Listeners
@ -1096,6 +1125,16 @@ end}.
{datatype, string} {datatype, string}
]}. ]}.
{mapping, "listener.wss.$name.proxy_address_header", "emqttd.listeners", [
{datatype, string},
hidden
]}.
{mapping, "listener.wss.$name.proxy_port_header", "emqttd.listeners", [
{datatype, string},
hidden
]}.
{mapping, "listener.wss.$name.proxy_protocol", "emqttd.listeners", [ {mapping, "listener.wss.$name.proxy_protocol", "emqttd.listeners", [
{datatype, flag} {datatype, flag}
]}. ]}.
@ -1144,6 +1183,11 @@ end}.
hidden hidden
]}. ]}.
{mapping, "listener.wss.$name.reuseaddr", "emqttd.listeners", [
{datatype, {enum, [true, false]}},
hidden
]}.
{mapping, "listener.wss.$name.tls_versions", "emqttd.listeners", [ {mapping, "listener.wss.$name.tls_versions", "emqttd.listeners", [
{datatype, string} {datatype, string}
]}. ]}.
@ -1220,7 +1264,9 @@ end}.
{proxy_protocol, cuttlefish:conf_get(Prefix ++ ".proxy_protocol", Conf, undefined)}, {proxy_protocol, cuttlefish:conf_get(Prefix ++ ".proxy_protocol", Conf, undefined)},
{proxy_protocol_timeout, cuttlefish:conf_get(Prefix ++ ".proxy_protocol_timeout", Conf, undefined)}, {proxy_protocol_timeout, cuttlefish:conf_get(Prefix ++ ".proxy_protocol_timeout", Conf, undefined)},
{mountpoint, MountPoint(cuttlefish:conf_get(Prefix ++ ".mountpoint", Conf, undefined))}, {mountpoint, MountPoint(cuttlefish:conf_get(Prefix ++ ".mountpoint", Conf, undefined))},
{peer_cert_as_username, cuttlefish:conf_get(Prefix ++ ".peer_cert_as_username", Conf, undefined)}]) {peer_cert_as_username, cuttlefish:conf_get(Prefix ++ ".peer_cert_as_username", Conf, undefined)},
{proxy_port_header, cuttlefish:conf_get(Prefix ++ ".proxy_port_header", Conf, undefined)},
{proxy_address_header, cuttlefish:conf_get(Prefix ++ ".proxy_address_header", Conf, undefined)}])
end, end,
LisOpts = fun(Prefix) -> LisOpts = fun(Prefix) ->
@ -1235,7 +1281,8 @@ end}.
{recbuf, cuttlefish:conf_get(Prefix ++ ".recbuf", Conf, undefined)}, {recbuf, cuttlefish:conf_get(Prefix ++ ".recbuf", Conf, undefined)},
{sndbuf, cuttlefish:conf_get(Prefix ++ ".sndbuf", Conf, undefined)}, {sndbuf, cuttlefish:conf_get(Prefix ++ ".sndbuf", Conf, undefined)},
{buffer, cuttlefish:conf_get(Prefix ++ ".buffer", Conf, undefined)}, {buffer, cuttlefish:conf_get(Prefix ++ ".buffer", Conf, undefined)},
{nodelay, cuttlefish:conf_get(Prefix ++ ".nodelay", Conf, true)}]) {nodelay, cuttlefish:conf_get(Prefix ++ ".nodelay", Conf, true)},
{reuseaddr, cuttlefish:conf_get(Prefix ++ ".reuseaddr", Conf, true)}])
end, end,
SplitFun = fun(undefined) -> undefined; (S) -> string:tokens(S, ",") end, SplitFun = fun(undefined) -> undefined; (S) -> string:tokens(S, ",") end,
@ -1265,7 +1312,8 @@ end}.
undefined -> undefined ->
[]; [];
ListenOn -> ListenOn ->
[{Atom(Type), ListenOn, [{connopts, ConnOpts(Prefix)}, {sockopts, TcpOpts(Prefix)} | LisOpts(Prefix)]}] [{Atom(Type), ListenOn, [{connopts, ConnOpts(Prefix)},
{sockopts, TcpOpts(Prefix)} | LisOpts(Prefix)]}]
end end
end, end,
@ -1374,6 +1422,11 @@ end}.
hidden hidden
]}. ]}.
{mapping, "listener.api.$name.reuseaddr", "emqttd.listeners", [
{datatype, {enum, [true, false]}},
hidden
]}.
{mapping, "listener.api.$name.handshake_timeout", "emqttd.listeners", [ {mapping, "listener.api.$name.handshake_timeout", "emqttd.listeners", [
{datatype, {duration, ms}} {datatype, {duration, ms}}
]}. ]}.

View File

@ -1,6 +1,6 @@
{application,emqttd, {application,emqttd,
[{description,"Erlang MQTT Broker"}, [{description,"Erlang MQTT Broker"},
{vsn,"2.3.3"}, {vsn,"2.3.4"},
{modules,[]}, {modules,[]},
{registered,[emqttd_sup]}, {registered,[emqttd_sup]},
{applications,[kernel,stdlib,gproc,lager,esockd,mochiweb, {applications,[kernel,stdlib,gproc,lager,esockd,mochiweb,

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.
@ -45,7 +45,7 @@ http_api() ->
%% Handle HTTP Request %% Handle HTTP Request
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
handle_request(Req, State) -> handle_request(Req, State) ->
Path = Req:get(path), {Path, _, _} = mochiweb_util:urlsplit_path(Req:get(raw_path)),
case Path of case Path of
"/status" -> "/status" ->
handle_request("/status", Req, Req:get(method)); handle_request("/status", Req, Req:get(method));
@ -58,7 +58,7 @@ handle_request(Req, State) ->
end. end.
inner_handle_request(Req, State) -> inner_handle_request(Req, State) ->
Path = Req:get(path), {Path, _, _} = mochiweb_util:urlsplit_path(Req:get(raw_path)),
case Path of case Path of
"/api/v2/auth" -> handle_request(Path, Req, State); "/api/v2/auth" -> handle_request(Path, Req, State);
_ -> if_authorized(Req, fun() -> handle_request(Path, Req, State) end) _ -> if_authorized(Req, fun() -> handle_request(Path, Req, State) end)
@ -95,7 +95,8 @@ dispatcher(APIs) ->
case {check_params(Params, FilterArgs), case {check_params(Params, FilterArgs),
check_params_type(Params, FilterArgs)} of check_params_type(Params, FilterArgs)} of
{true, true} -> {true, true} ->
{match, [MatchList]} = re:run(Url, Regexp, [global, {capture, all_but_first, list}]), {match, [MatchList0]} = re:run(Url, Regexp, [global, {capture, all_but_first, list}]),
MatchList = lists:map(fun mochiweb_util:unquote/1, MatchList0),
Args = lists:append([[Method, Params], MatchList]), Args = lists:append([[Method, Params], MatchList]),
lager:debug("Mod:~p, Fun:~p, Args:~p", [emqttd_rest_api, Function, Args]), lager:debug("Mod:~p, Fun:~p, Args:~p", [emqttd_rest_api, Function, Args]),
case catch apply(emqttd_rest_api, Function, Args) of case catch apply(emqttd_rest_api, Function, Args) of

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. %% Copyright (c) 2013-2018 EMQ Enterprise, Inc.
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.
@ -563,8 +563,11 @@ sp(false) -> 0.
%% The retained flag should be propagated for bridge. %% The retained flag should be propagated for bridge.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
clean_retain(false, Msg = #mqtt_message{retain = true}) -> clean_retain(false, Msg = #mqtt_message{retain = true, headers = Headers}) ->
Msg#mqtt_message{retain = false}; case lists:member(retained, Headers) of
true -> Msg;
false -> Msg#mqtt_message{retain = false}
end;
clean_retain(_IsBridge, Msg) -> clean_retain(_IsBridge, Msg) ->
Msg. Msg.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.
@ -286,8 +286,8 @@ init([CleanSess, {ClientId, Username}, ClientPid]) ->
{ok, QEnv} = emqttd:env(mqueue), {ok, QEnv} = emqttd:env(mqueue),
MaxInflight = get_value(max_inflight, Env, 0), MaxInflight = get_value(max_inflight, Env, 0),
EnableStats = get_value(enable_stats, Env, false), EnableStats = get_value(enable_stats, Env, false),
IgnoreLoopDeliver = get_value(ignore_loop_deliver, Env, false),
ForceGcCount = emqttd_gc:conn_max_gc_count(), ForceGcCount = emqttd_gc:conn_max_gc_count(),
IgnoreLoopDeliver = get_value(ignore_loop_deliver, Env, false),
MQueue = ?MQueue:new(ClientId, QEnv, emqttd_alarm:alarm_fun()), MQueue = ?MQueue:new(ClientId, QEnv, emqttd_alarm:alarm_fun()),
State = #state{clean_sess = CleanSess, State = #state{clean_sess = CleanSess,
binding = binding(ClientPid), binding = binding(ClientPid),

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%% %%
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
-module(emqttd_inflight_SUITE). -module(emqttd_inflight_SUITE).

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io) %% Copyright (c) 2013-2018 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.