From 24d9b46836f691bd68decc9654bb1bbd07703555 Mon Sep 17 00:00:00 2001 From: Ery Lee Date: Sat, 10 Jan 2015 15:12:42 +0800 Subject: [PATCH] add throttle, bridge --- apps/emqtt/src/emqtt_auth_internal.erl | 2 +- apps/emqtt/src/emqtt_bridge.erl | 26 +++++++++++++++++++ apps/emqtt/src/emqtt_client.erl | 1 + ...qtt_keep_alive.erl => emqtt_keepalive.erl} | 2 +- apps/emqtt/src/emqtt_packet.erl | 2 +- apps/emqtt/src/emqtt_session.erl | 2 +- apps/emqtt/src/emqtt_throttle.erl | 26 +++++++++++++++++++ 7 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 apps/emqtt/src/emqtt_bridge.erl rename apps/emqtt/src/{emqtt_keep_alive.erl => emqtt_keepalive.erl} (98%) create mode 100644 apps/emqtt/src/emqtt_throttle.erl diff --git a/apps/emqtt/src/emqtt_auth_internal.erl b/apps/emqtt/src/emqtt_auth_internal.erl index de6df9ab1..c0d5a6d10 100644 --- a/apps/emqtt/src/emqtt_auth_internal.erl +++ b/apps/emqtt/src/emqtt_auth_internal.erl @@ -1,5 +1,5 @@ %%----------------------------------------------------------------------------- -%% Copyright (c) 2015, Feng Lee +%% Copyright (c) 2012-2015, Feng Lee %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the "Software"), to deal diff --git a/apps/emqtt/src/emqtt_bridge.erl b/apps/emqtt/src/emqtt_bridge.erl new file mode 100644 index 000000000..04df2955d --- /dev/null +++ b/apps/emqtt/src/emqtt_bridge.erl @@ -0,0 +1,26 @@ +%%----------------------------------------------------------------------------- +%% Copyright (c) 2012-2015, Feng Lee +%% +%% Permission is hereby granted, free of charge, to any person obtaining a copy +%% of this software and associated documentation files (the "Software"), to deal +%% in the Software without restriction, including without limitation the rights +%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +%% copies of the Software, and to permit persons to whom the Software is +%% furnished to do so, subject to the following conditions: +%% +%% The above copyright notice and this permission notice shall be included in all +%% copies or substantial portions of the Software. +%% +%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +%% SOFTWARE. +%%------------------------------------------------------------------------------ + +-module(emqtt_bridge). + + + diff --git a/apps/emqtt/src/emqtt_client.erl b/apps/emqtt/src/emqtt_client.erl index cc87e8cf2..ade78783c 100644 --- a/apps/emqtt/src/emqtt_client.erl +++ b/apps/emqtt/src/emqtt_client.erl @@ -213,3 +213,4 @@ control_throttle(State = #state{ conn_state = Flow, stop(Reason, State ) -> {stop, Reason, State}. + diff --git a/apps/emqtt/src/emqtt_keep_alive.erl b/apps/emqtt/src/emqtt_keepalive.erl similarity index 98% rename from apps/emqtt/src/emqtt_keep_alive.erl rename to apps/emqtt/src/emqtt_keepalive.erl index 048f0dde7..1106f7460 100644 --- a/apps/emqtt/src/emqtt_keep_alive.erl +++ b/apps/emqtt/src/emqtt_keepalive.erl @@ -20,7 +20,7 @@ %% SOFTWARE. %%------------------------------------------------------------------------------ --module(emqtt_keep_alive). +-module(emqtt_keepalive). -author('feng@emqtt.io'). diff --git a/apps/emqtt/src/emqtt_packet.erl b/apps/emqtt/src/emqtt_packet.erl index f5b58e0a7..81d07351a 100644 --- a/apps/emqtt/src/emqtt_packet.erl +++ b/apps/emqtt/src/emqtt_packet.erl @@ -1,5 +1,5 @@ %%------------------------------------------------------------------------------ -%% Copyright (c) 2015, Feng Lee +%% Copyright (c) 2012-2015, Feng Lee %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the "Software"), to deal diff --git a/apps/emqtt/src/emqtt_session.erl b/apps/emqtt/src/emqtt_session.erl index 35ade693e..145d7fb18 100644 --- a/apps/emqtt/src/emqtt_session.erl +++ b/apps/emqtt/src/emqtt_session.erl @@ -1,5 +1,5 @@ %%----------------------------------------------------------------------------- -%% Copyright (c) 2015, Feng Lee +%% Copyright (c) 2012-2015, Feng Lee %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the "Software"), to deal diff --git a/apps/emqtt/src/emqtt_throttle.erl b/apps/emqtt/src/emqtt_throttle.erl new file mode 100644 index 000000000..1e56cda52 --- /dev/null +++ b/apps/emqtt/src/emqtt_throttle.erl @@ -0,0 +1,26 @@ +%%----------------------------------------------------------------------------- +%% Copyright (c) 2012-2015, Feng Lee +%% +%% Permission is hereby granted, free of charge, to any person obtaining a copy +%% of this software and associated documentation files (the "Software"), to deal +%% in the Software without restriction, including without limitation the rights +%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +%% copies of the Software, and to permit persons to whom the Software is +%% furnished to do so, subject to the following conditions: +%% +%% The above copyright notice and this permission notice shall be included in all +%% copies or substantial portions of the Software. +%% +%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +%% SOFTWARE. +%%------------------------------------------------------------------------------ + +-module(emqtt_throttle). + + +