Procházet zdrojové kódy

Merge pull request #1477 from emqtt/develop

Version 2.3.4
huangdan před 8 roky
rodič
revize
25557c9f22
93 změnil soubory, kde provedl 243 přidání a 130 odebrání
  1. 1 1
      Makefile
  2. 83 27
      etc/emq.conf
  3. 2 2
      include/emqttd.hrl
  4. 1 1
      include/emqttd_cli.hrl
  5. 1 1
      include/emqttd_internal.hrl
  6. 1 1
      include/emqttd_protocol.hrl
  7. 1 1
      include/emqttd_trie.hrl
  8. 58 5
      priv/emq.schema
  9. 1 1
      src/emqttd.app.src
  10. 1 1
      src/emqttd.erl
  11. 1 1
      src/emqttd_access_control.erl
  12. 1 1
      src/emqttd_access_rule.erl
  13. 1 1
      src/emqttd_acl_internal.erl
  14. 1 1
      src/emqttd_acl_mod.erl
  15. 1 1
      src/emqttd_alarm.erl
  16. 1 1
      src/emqttd_app.erl
  17. 1 1
      src/emqttd_auth_mod.erl
  18. 1 1
      src/emqttd_base62.erl
  19. 1 1
      src/emqttd_boot.erl
  20. 1 1
      src/emqttd_bridge.erl
  21. 1 1
      src/emqttd_bridge_sup.erl
  22. 1 1
      src/emqttd_bridge_sup_sup.erl
  23. 1 1
      src/emqttd_broker.erl
  24. 1 1
      src/emqttd_cli.erl
  25. 1 1
      src/emqttd_cli_config.erl
  26. 1 1
      src/emqttd_client.erl
  27. 1 1
      src/emqttd_cm.erl
  28. 1 1
      src/emqttd_cm_sup.erl
  29. 1 1
      src/emqttd_config.erl
  30. 1 1
      src/emqttd_ctl.erl
  31. 1 1
      src/emqttd_gc.erl
  32. 1 1
      src/emqttd_gen_mod.erl
  33. 1 1
      src/emqttd_guid.erl
  34. 1 1
      src/emqttd_hooks.erl
  35. 5 4
      src/emqttd_http.erl
  36. 1 1
      src/emqttd_inflight.erl
  37. 1 1
      src/emqttd_keepalive.erl
  38. 1 1
      src/emqttd_message.erl
  39. 1 1
      src/emqttd_metrics.erl
  40. 1 1
      src/emqttd_mgmt.erl
  41. 1 1
      src/emqttd_misc.erl
  42. 1 1
      src/emqttd_mod_sup.erl
  43. 1 1
      src/emqttd_mqueue.erl
  44. 1 1
      src/emqttd_net.erl
  45. 1 1
      src/emqttd_packet.erl
  46. 1 1
      src/emqttd_parser.erl
  47. 1 1
      src/emqttd_plugins.erl
  48. 1 1
      src/emqttd_pmon.erl
  49. 1 1
      src/emqttd_pool_sup.erl
  50. 1 1
      src/emqttd_pooler.erl
  51. 6 3
      src/emqttd_protocol.erl
  52. 1 1
      src/emqttd_pubsub.erl
  53. 1 1
      src/emqttd_pubsub_sup.erl
  54. 1 1
      src/emqttd_rest_api.erl
  55. 1 1
      src/emqttd_router.erl
  56. 1 1
      src/emqttd_serializer.erl
  57. 1 1
      src/emqttd_server.erl
  58. 2 2
      src/emqttd_session.erl
  59. 1 1
      src/emqttd_session_sup.erl
  60. 1 1
      src/emqttd_sm.erl
  61. 1 1
      src/emqttd_sm_helper.erl
  62. 1 1
      src/emqttd_sm_sup.erl
  63. 1 1
      src/emqttd_stats.erl
  64. 1 1
      src/emqttd_sup.erl
  65. 1 1
      src/emqttd_sysmon.erl
  66. 1 1
      src/emqttd_sysmon_sup.erl
  67. 1 1
      src/emqttd_time.erl
  68. 1 1
      src/emqttd_topic.erl
  69. 1 1
      src/emqttd_trace.erl
  70. 1 1
      src/emqttd_trace_sup.erl
  71. 1 1
      src/emqttd_trie.erl
  72. 1 1
      src/emqttd_vm.erl
  73. 1 1
      src/emqttd_ws.erl
  74. 1 1
      src/emqttd_ws_client.erl
  75. 1 1
      src/emqttd_ws_client_sup.erl
  76. 1 1
      src/lager_emqtt_backend.erl
  77. 1 1
      test/emqttd_SUITE.erl
  78. 1 1
      test/emqttd_access_SUITE.erl
  79. 1 1
      test/emqttd_acl_test_mod.erl
  80. 1 1
      test/emqttd_auth_anonymous_test_mod.erl
  81. 1 1
      test/emqttd_auth_dashboard.erl
  82. 1 1
      test/emqttd_cli_SUITE.erl
  83. 1 1
      test/emqttd_config_SUITE.erl
  84. 1 1
      test/emqttd_inflight_SUITE.erl
  85. 1 1
      test/emqttd_lib_SUITE.erl
  86. 1 1
      test/emqttd_mod_SUITE.erl
  87. 1 1
      test/emqttd_mqueue_SUITE.erl
  88. 1 1
      test/emqttd_net_SUITE.erl
  89. 1 1
      test/emqttd_protocol_SUITE.erl
  90. 1 1
      test/emqttd_router_SUITE.erl
  91. 1 1
      test/emqttd_topic_SUITE.erl
  92. 1 1
      test/emqttd_trie_SUITE.erl
  93. 1 1
      test/emqttd_vm_SUITE.erl

+ 1 - 1
Makefile

@@ -1,6 +1,6 @@
 PROJECT = emqttd
 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
 

+ 83 - 27
etc/emq.conf

@@ -231,6 +231,15 @@ node.fullsweep_after = 1000
 ## Value: Log file
 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.
 ## Notice that all communicating nodes are to have the same TickTime
 ## value specified.
@@ -695,6 +704,11 @@ listener.tcp.external.tune_buffer = on
 ## Value: true | false
 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
 
@@ -791,6 +805,11 @@ listener.tcp.internal.tune_buffer = on
 ## Value: true | 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
 
@@ -1020,10 +1039,15 @@ listener.ssl.external.certfile = {{ platform_etc_dir }}/certs/cert.pem
 ## Value: true | false
 ## 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
 
-## 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.
 ##
 ## 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
 listener.ws.external = 8083
 
-## The acceptor pool for external MQTT/Websocket listener.
+## The acceptor pool for external MQTT/WebSocket listener.
 ##
 ## Value: Number
 listener.ws.external.acceptors = 4
 
-## Maximum number of concurrent MQTT/Websocket connections.
+## Maximum number of concurrent MQTT/WebSocket connections.
 ##
 ## Value: Number
 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
 ## listener.ws.external.zone = external
 
-## Mountpoint of the MQTT/Websocket Listener.
+## Mountpoint of the MQTT/WebSocket Listener.
 ##
 ## See: listener.tcp.<name>.mountpoint
 ##
 ## Value: String
 ## 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
 ##
 ## Value: ACL Rule
 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
 ## HAProxy or Nginx.
 ##
@@ -1075,37 +1111,37 @@ listener.ws.external.access.1 = allow all
 ## Value: Duration
 ## 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
 ##
 ## Value: Number >= 0
 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
 ##
 ## Value: Duration
 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
 ##
 ## Value: on | off
 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
 ##
 ## Value: Bytes
 ## 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
 ## listener.ws.external.sndbuf = 4KB
@@ -1124,17 +1160,22 @@ listener.ws.external.send_timeout_close = on
 ## Value: on | off
 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
 ##
 ## Value: true | false
 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
 
-## 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.
 ##
 ## Value: IP:Port | Port
@@ -1142,7 +1183,7 @@ listener.ws.external.nodelay = true
 ## Examples: 8084, 127.0.0.1:8084, ::1: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
 listener.wss.external.acceptors = 4
@@ -1152,25 +1193,35 @@ listener.wss.external.acceptors = 4
 ## Value: Number
 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
 ## 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
 ## 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>
 ##
 ## Value: ACL Rule
 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.
 ##
 ## See: listener.tcp.<name>.proxy_protocol
@@ -1260,35 +1311,35 @@ listener.wss.external.certfile = {{ platform_etc_dir }}/certs/cert.pem
 ## Value: cn | dn
 ## 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
 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
 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
 ##
 ## Value: on | off
 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
 ##
 ## Value: Bytes
 ## 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
 ##
@@ -1302,13 +1353,18 @@ listener.wss.external.send_timeout_close = on
 ## Value: Bytes
 ## 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
 ##
 ## Value: true | false
 ## 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
 

+ 2 - 2
include/emqttd.hrl

@@ -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");
 %% you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
 %% 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").
 

+ 1 - 1
include/emqttd_cli.hrl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
include/emqttd_internal.hrl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
include/emqttd_protocol.hrl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
include/emqttd_trie.hrl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 58 - 5
priv/emq.schema

@@ -168,6 +168,11 @@ end}.
   {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
 {mapping, "node.cookie", "vm_args.-setcookie", [
   {default, "emqsecretcookie"}
@@ -400,7 +405,7 @@ end}.
 {translation,
  "lager.handlers",
  fun(Conf) ->
-    ErrorHandler = case cuttlefish:conf_get("log.error.file", Conf) of
+    ErrorHandler = case cuttlefish:conf_get("log.error.file", Conf, undefined) of
       undefined -> [];
       ErrorFilename -> [{lager_file_backend, [{file, ErrorFilename},
                                               {level, error},
@@ -442,7 +447,6 @@ end}.
                    cuttlefish:conf_get("log.syslog.facility", Conf),
                    cuttlefish:conf_get("log.syslog.level", Conf)]}]
     end,
-
     ConsoleHandlers ++ ErrorHandler ++ InfoHandler ++ SyslogHandler
   end
 }.
@@ -846,6 +850,11 @@ end}.
   hidden
 ]}.
 
+{mapping, "listener.tcp.$name.reuseaddr", "emqttd.listeners", [
+  {datatype, {enum, [true, false]}},
+  hidden
+]}.
+
 %%--------------------------------------------------------------------
 %% SSL Listeners
 
@@ -928,6 +937,11 @@ end}.
   hidden
 ]}.
 
+{mapping, "listener.ssl.$name.reuseaddr", "emqttd.listeners", [
+  {datatype, {enum, [true, false]}},
+  hidden
+]}.
+
 {mapping, "listener.ssl.$name.tls_versions", "emqttd.listeners", [
   {datatype, string}
 ]}.
@@ -1015,6 +1029,16 @@ end}.
   {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", [
   {datatype, flag}
 ]}.
@@ -1063,6 +1087,11 @@ end}.
   hidden
 ]}.
 
+{mapping, "listener.ws.$name.reuseaddr", "emqttd.listeners", [
+  {datatype, {enum, [true, false]}},
+  hidden
+]}.
+
 %%--------------------------------------------------------------------
 %% MQTT/WebSocket/SSL Listeners
 
@@ -1096,6 +1125,16 @@ end}.
   {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", [
   {datatype, flag}
 ]}.
@@ -1144,6 +1183,11 @@ end}.
   hidden
 ]}.
 
+{mapping, "listener.wss.$name.reuseaddr", "emqttd.listeners", [
+  {datatype, {enum, [true, false]}},
+  hidden
+]}.
+
 {mapping, "listener.wss.$name.tls_versions", "emqttd.listeners", [
   {datatype, string}
 ]}.
@@ -1220,7 +1264,9 @@ end}.
                            {proxy_protocol, cuttlefish:conf_get(Prefix ++ ".proxy_protocol", Conf, undefined)},
                            {proxy_protocol_timeout, cuttlefish:conf_get(Prefix ++ ".proxy_protocol_timeout", 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,
 
     LisOpts = fun(Prefix) ->
@@ -1235,7 +1281,8 @@ end}.
                            {recbuf,  cuttlefish:conf_get(Prefix ++ ".recbuf", Conf, undefined)},
                            {sndbuf,  cuttlefish:conf_get(Prefix ++ ".sndbuf", 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,
 
     SplitFun = fun(undefined) -> undefined; (S) -> string:tokens(S, ",") end,
@@ -1265,7 +1312,8 @@ end}.
                            undefined ->
                                [];
                            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,
 
@@ -1374,6 +1422,11 @@ end}.
   hidden
 ]}.
 
+{mapping, "listener.api.$name.reuseaddr", "emqttd.listeners", [
+  {datatype, {enum, [true, false]}},
+  hidden
+]}.
+
 {mapping, "listener.api.$name.handshake_timeout", "emqttd.listeners", [
   {datatype, {duration, ms}}
 ]}.

+ 1 - 1
src/emqttd.app.src

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

+ 1 - 1
src/emqttd.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_access_control.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_access_rule.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_acl_internal.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_acl_mod.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_alarm.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_app.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_auth_mod.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_base62.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_boot.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_bridge.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_bridge_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_bridge_sup_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_broker.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_cli.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_cli_config.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_client.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_cm.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_cm_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_config.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_ctl.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_gc.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_gen_mod.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_guid.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_hooks.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 5 - 4
src/emqttd_http.erl

@@ -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");
 %% you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ http_api() ->
 %% Handle HTTP Request
 %%--------------------------------------------------------------------
 handle_request(Req, State) ->
-    Path = Req:get(path),
+    {Path, _, _} = mochiweb_util:urlsplit_path(Req:get(raw_path)),
     case Path of
         "/status" ->
             handle_request("/status", Req, Req:get(method));
@@ -58,7 +58,7 @@ handle_request(Req, State) ->
     end.
 
 inner_handle_request(Req, State) ->
-    Path = Req:get(path),
+    {Path, _, _} = mochiweb_util:urlsplit_path(Req:get(raw_path)),
     case Path of
         "/api/v2/auth" -> handle_request(Path, Req, State);
         _ -> if_authorized(Req, fun() -> handle_request(Path, Req, State) end)
@@ -95,7 +95,8 @@ dispatcher(APIs) ->
                         case {check_params(Params, FilterArgs),
                               check_params_type(Params, FilterArgs)} of
                             {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]),
                                 lager:debug("Mod:~p, Fun:~p, Args:~p", [emqttd_rest_api, Function, Args]),
                                 case catch apply(emqttd_rest_api, Function, Args) of

+ 1 - 1
src/emqttd_inflight.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_keepalive.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_message.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_metrics.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_mgmt.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_misc.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_mod_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_mqueue.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_net.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_packet.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_parser.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_plugins.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_pmon.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_pool_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_pooler.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 6 - 3
src/emqttd_protocol.erl

@@ -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");
 %% 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.
 %%--------------------------------------------------------------------
 
-clean_retain(false, Msg = #mqtt_message{retain = true}) ->
-    Msg#mqtt_message{retain = false};
+clean_retain(false, Msg = #mqtt_message{retain = true, headers = Headers}) ->
+    case lists:member(retained, Headers) of
+        true  -> Msg;
+        false -> Msg#mqtt_message{retain = false}
+    end;
 clean_retain(_IsBridge, Msg) ->
     Msg.
 

+ 1 - 1
src/emqttd_pubsub.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_pubsub_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_rest_api.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_router.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_serializer.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_server.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 2 - 2
src/emqttd_session.erl

@@ -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");
 %% 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),
     MaxInflight = get_value(max_inflight, Env, 0),
     EnableStats = get_value(enable_stats, Env, false),
-    IgnoreLoopDeliver = get_value(ignore_loop_deliver, Env, false),
     ForceGcCount = emqttd_gc:conn_max_gc_count(),
+    IgnoreLoopDeliver = get_value(ignore_loop_deliver, Env, false),
     MQueue = ?MQueue:new(ClientId, QEnv, emqttd_alarm:alarm_fun()),
     State = #state{clean_sess        = CleanSess,
                    binding           = binding(ClientPid),

+ 1 - 1
src/emqttd_session_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_sm.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_sm_helper.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_sm_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_stats.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_sysmon.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_sysmon_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_time.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_topic.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_trace.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_trace_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_trie.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_vm.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_ws.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_ws_client.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/emqttd_ws_client_sup.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
src/lager_emqtt_backend.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_access_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_acl_test_mod.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_auth_anonymous_test_mod.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_auth_dashboard.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_cli_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_config_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_inflight_SUITE.erl

@@ -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).

+ 1 - 1
test/emqttd_lib_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_mod_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_mqueue_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_net_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_protocol_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_router_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_topic_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_trie_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.

+ 1 - 1
test/emqttd_vm_SUITE.erl

@@ -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");
 %% you may not use this file except in compliance with the License.