0.2.0 upgrade
This commit is contained in:
parent
eb08b6bae0
commit
d5b6152aa8
3
Makefile
3
Makefile
|
@ -8,6 +8,7 @@ deps:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
./rebar clean
|
./rebar clean
|
||||||
|
rm -rf rel/emqtt
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
./rebar generate -f
|
cd rel && ../rebar generate -f
|
||||||
|
|
3
TODO
3
TODO
|
@ -8,9 +8,12 @@
|
||||||
5 cluster...
|
5 cluster...
|
||||||
6. support MQTT3.1.1...
|
6. support MQTT3.1.1...
|
||||||
7. python, java test code
|
7. python, java test code
|
||||||
|
8. emqtt_cm to manager clientId, clientPid...
|
||||||
|
|
||||||
|
|
||||||
????
|
????
|
||||||
{ok, {{simple_one_for_one_terminate, 0, 1},
|
{ok, {{simple_one_for_one_terminate, 0, 1},
|
||||||
[{client, {emqtt_client, start_link, []},
|
[{client, {emqtt_client, start_link, []},
|
||||||
temporary, 5000, worker, [emqtt_client]}]}}.
|
temporary, 5000, worker, [emqtt_client]}]}}.
|
||||||
|
|
||||||
|
fucking stupid..... esockd locked
|
||||||
|
|
|
@ -1,28 +1,35 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%------------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License
|
%%
|
||||||
%% at http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% the License for the specific language governing rights and
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% limitations under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%%
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%% The Initial Developer of the Original Code is ery.lee@gmail.com
|
%% copies or substantial portions of the Software.
|
||||||
%% Copyright (c) 2012 Ery Lee. All rights reserved.
|
%%
|
||||||
%%
|
%% 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.
|
||||||
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
%% ---------------------------------
|
%% ---------------------------------
|
||||||
%% banner
|
%% banner
|
||||||
%% ---------------------------------
|
%% ---------------------------------
|
||||||
-define(COPYRIGHT, "Copyright (C) 2012 Ery Lee.").
|
-define(COPYRIGHT, "Copyright (C) 2014, Feng Lee<feng.lee@slimchat.io>").
|
||||||
|
|
||||||
-define(LICENSE_MESSAGE, "Licensed under the MPL.").
|
-define(LICENSE_MESSAGE, "Licensed under MIT").
|
||||||
|
|
||||||
-define(PROTOCOL_VERSION, "MQTT/3.1").
|
-define(PROTOCOL_VERSION, "MQTT/3.1").
|
||||||
|
|
||||||
-define(ERTS_MINIMUM, "5.6.3").
|
-define(ERTS_MINIMUM, "6.0").
|
||||||
|
|
||||||
%% qos levels
|
%% qos levels
|
||||||
|
|
||||||
|
@ -30,10 +37,13 @@
|
||||||
-define(QOS_1, 1).
|
-define(QOS_1, 1).
|
||||||
-define(QOS_2, 2).
|
-define(QOS_2, 2).
|
||||||
|
|
||||||
-record(mqtt_msg, {retain,
|
-record(mqtt_msg, {
|
||||||
qos,
|
retain,
|
||||||
topic,
|
qos,
|
||||||
dup,
|
topic,
|
||||||
message_id,
|
dup,
|
||||||
payload,
|
msgid,
|
||||||
encoder}).
|
payload,
|
||||||
|
encoder
|
||||||
|
}).
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,12 @@
|
||||||
{application, emqtt,
|
{application, emqtt,
|
||||||
[
|
[
|
||||||
{description, "erlang mqtt broker"},
|
{description, "Erlang MQTT Broker"},
|
||||||
{vsn, "0.1.5"},
|
{vsn, git},
|
||||||
{modules, [
|
{modules, []},
|
||||||
emqtt,
|
|
||||||
emqtt_app,
|
|
||||||
emqtt_auth,
|
|
||||||
emqtt_auth_anonymous,
|
|
||||||
emqtt_auth_internal,
|
|
||||||
emqtt_client,
|
|
||||||
emqtt_client_sup,
|
|
||||||
emqtt_client_monitor,
|
|
||||||
emqtt_ctl,
|
|
||||||
emqtt_db,
|
|
||||||
emqtt_frame,
|
|
||||||
emqtt_lib,
|
|
||||||
emqtt_listener,
|
|
||||||
emqtt_net,
|
|
||||||
emqtt_router,
|
|
||||||
emqtt_registry,
|
|
||||||
emqtt_sup,
|
|
||||||
gen_server2,
|
|
||||||
priority_queue,
|
|
||||||
supervisor2
|
|
||||||
]},
|
|
||||||
{registered, [emqtt_auth,
|
{registered, [emqtt_auth,
|
||||||
emqtt_router,
|
emqtt_router,
|
||||||
emqtt_registry,
|
emqtt_registry
|
||||||
emqtt_client_monitor]},
|
]},
|
||||||
{applications, [kernel,
|
{applications, [kernel,
|
||||||
stdlib]},
|
stdlib]},
|
||||||
{mod, {emqtt_app, []}},
|
{mod, {emqtt_app, []}},
|
||||||
|
|
|
@ -1,25 +1,30 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License at
|
%%
|
||||||
%% http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% License for the specific language governing rights and limitations
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% The Original Code is eMQTT
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%%
|
%% copies or substantial portions of the Software.
|
||||||
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
|
%%
|
||||||
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
|
%% 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_app).
|
-module(emqtt_app).
|
||||||
|
|
||||||
-author('ery.lee@gmail.com').
|
-author('ery.lee@gmail.com').
|
||||||
|
|
||||||
-include("emqtt.hrl").
|
-include("emqtt_log.hrl").
|
||||||
|
|
||||||
-include_lib("elog/include/elog.hrl").
|
|
||||||
|
|
||||||
-behaviour(application).
|
-behaviour(application).
|
||||||
|
|
||||||
|
@ -34,13 +39,22 @@
|
||||||
%% @spec start(atom(), list()) -> {ok, pid()}
|
%% @spec start(atom(), list()) -> {ok, pid()}
|
||||||
%%
|
%%
|
||||||
start(_StartType, _StartArgs) ->
|
start(_StartType, _StartArgs) ->
|
||||||
?INFO("starting emqtt on node '~s'", [node()]),
|
print_banner(),
|
||||||
{ok, Listeners} = application:get_env(listeners),
|
{ok, SupPid} = emqtt_sup:start_link(),
|
||||||
{ok, SupPid} = emqtt_sup:start_link(Listeners),
|
{ok, Listeners} = application:get_env(listen),
|
||||||
|
emqtt_listener:start(Listeners),
|
||||||
register(emqtt, self()),
|
register(emqtt, self()),
|
||||||
?INFO_MSG("emqtt broker is running now."),
|
print_vsn(),
|
||||||
{ok, SupPid}.
|
{ok, SupPid}.
|
||||||
|
|
||||||
|
print_banner() ->
|
||||||
|
?PRINT("starting emqtt on node '~s'~n", [node()]).
|
||||||
|
|
||||||
|
print_vsn() ->
|
||||||
|
{ok, Vsn} = application:get_key(vsn),
|
||||||
|
{ok, Desc} = application:get_key(description),
|
||||||
|
?PRINT("~s ~s is running now~n", [Desc, Vsn]).
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% @spec stop(atom) -> 'ok'
|
%% @spec stop(atom) -> 'ok'
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License at
|
%%
|
||||||
%% http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% License for the specific language governing rights and limitations
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% The Original Code is eMQTT
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%%
|
%% copies or substantial portions of the Software.
|
||||||
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
|
%%
|
||||||
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
|
%% 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_auth).
|
-module(emqtt_auth).
|
||||||
|
|
||||||
|
@ -19,7 +26,8 @@
|
||||||
|
|
||||||
-include("emqtt.hrl").
|
-include("emqtt.hrl").
|
||||||
|
|
||||||
-include_lib("elog/include/elog.hrl").
|
-include("emqtt_log.hrl").
|
||||||
|
|
||||||
|
|
||||||
-export([start_link/0,
|
-export([start_link/0,
|
||||||
add/2,
|
add/2,
|
||||||
|
@ -38,16 +46,16 @@
|
||||||
-record(state, {authmod, authopts}).
|
-record(state, {authmod, authopts}).
|
||||||
|
|
||||||
start_link() ->
|
start_link() ->
|
||||||
gen_server2:start_link({local, ?MODULE}, ?MODULE, [], []).
|
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
|
||||||
|
|
||||||
check(Username, Password) ->
|
check(Username, Password) ->
|
||||||
gen_server2:call(?MODULE, {check, Username, Password}).
|
gen_server:call(?MODULE, {check, Username, Password}).
|
||||||
|
|
||||||
add(Username, Password) when is_binary(Username) ->
|
add(Username, Password) when is_binary(Username) ->
|
||||||
gen_server2:call(?MODULE, {add, Username, Password}).
|
gen_server:call(?MODULE, {add, Username, Password}).
|
||||||
|
|
||||||
delete(Username) when is_binary(Username) ->
|
delete(Username) when is_binary(Username) ->
|
||||||
gen_server2:cast(?MODULE, {delete, Username}).
|
gen_server:cast(?MODULE, {delete, Username}).
|
||||||
|
|
||||||
init([]) ->
|
init([]) ->
|
||||||
{ok, {Name, Opts}} = application:get_env(auth),
|
{ok, {Name, Opts}} = application:get_env(auth),
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License at
|
%%
|
||||||
%% http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% License for the specific language governing rights and limitations
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% The Original Code is eMQTT
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%%
|
%% copies or substantial portions of the Software.
|
||||||
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
|
%%
|
||||||
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
|
%% 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_auth_internal).
|
-module(emqtt_auth_internal).
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,30 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License at
|
%%
|
||||||
%% http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% License for the specific language governing rights and limitations
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% The Original Code is eMQTT
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%%
|
%% copies or substantial portions of the Software.
|
||||||
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
|
%%
|
||||||
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
|
%% 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_client).
|
-module(emqtt_client).
|
||||||
|
|
||||||
-behaviour(gen_server2).
|
-behaviour(gen_server).
|
||||||
|
|
||||||
-export([start_link/0, go/2, info/1]).
|
-export([start_link/1, info/1]).
|
||||||
|
|
||||||
-export([init/1,
|
-export([init/1,
|
||||||
handle_call/3,
|
handle_call/3,
|
||||||
|
@ -28,12 +35,12 @@
|
||||||
|
|
||||||
-include("emqtt.hrl").
|
-include("emqtt.hrl").
|
||||||
|
|
||||||
|
-include("emqtt_log.hrl").
|
||||||
|
|
||||||
-include("emqtt_frame.hrl").
|
-include("emqtt_frame.hrl").
|
||||||
|
|
||||||
-include("emqtt_internal.hrl").
|
-include("emqtt_internal.hrl").
|
||||||
|
|
||||||
-include_lib("elog/include/elog.hrl").
|
|
||||||
|
|
||||||
-define(CLIENT_ID_MAXLEN, 23).
|
-define(CLIENT_ID_MAXLEN, 23).
|
||||||
|
|
||||||
-record(state, {socket,
|
-record(state, {socket,
|
||||||
|
@ -55,17 +62,36 @@
|
||||||
-define(FRAME_TYPE(Frame, Type),
|
-define(FRAME_TYPE(Frame, Type),
|
||||||
Frame = #mqtt_frame{ fixed = #mqtt_frame_fixed{ type = Type }}).
|
Frame = #mqtt_frame{ fixed = #mqtt_frame_fixed{ type = Type }}).
|
||||||
|
|
||||||
start_link() ->
|
start_link(Sock) ->
|
||||||
gen_server2:start_link(?MODULE, [], []).
|
Res = gen_server:start_link(?MODULE, [Sock], []),
|
||||||
|
?INFO("~p", [Res]).
|
||||||
go(Pid, Sock) ->
|
|
||||||
gen_server2:call(Pid, {go, Sock}, infinity).
|
|
||||||
|
|
||||||
info(Pid) ->
|
info(Pid) ->
|
||||||
gen_server2:call(Pid, info).
|
gen_server:call(Pid, info).
|
||||||
|
|
||||||
init([]) ->
|
init([Sock]) ->
|
||||||
{ok, undefined, hibernate, {backoff, 1000, 1000, 10000}}.
|
process_flag(trap_exit, true),
|
||||||
|
esockd_client:ack(Sock),
|
||||||
|
%%TODO: Move to esockd...
|
||||||
|
ok = throw_on_error(
|
||||||
|
inet_error, fun () -> emqtt_net:tune_buffer_size(Sock) end),
|
||||||
|
{ok, ConnStr} = emqtt_net:connection_string(Sock, inbound),
|
||||||
|
%FIXME: merge to registry
|
||||||
|
%%emqtt_client_monitor:mon(self()),
|
||||||
|
{ok,
|
||||||
|
control_throttle(
|
||||||
|
#state{ socket = Sock,
|
||||||
|
conn_name = ConnStr,
|
||||||
|
await_recv = false,
|
||||||
|
connection_state = running,
|
||||||
|
conserve = false,
|
||||||
|
parse_state = emqtt_frame:initial_state(),
|
||||||
|
message_id = 1,
|
||||||
|
subtopics = [],
|
||||||
|
awaiting_ack = gb_trees:empty(),
|
||||||
|
awaiting_rel = gb_trees:empty()})}.
|
||||||
|
|
||||||
|
%{ok, undefined, hibernate, {backoff, 1000, 1000, 10000}}.
|
||||||
|
|
||||||
handle_call(duplicate_id, _From, State=#state{conn_name=ConnName, client_id=ClientId}) ->
|
handle_call(duplicate_id, _From, State=#state{conn_name=ConnName, client_id=ClientId}) ->
|
||||||
?ERROR("Shutdown for duplicate clientid:~s, conn:~s", [ClientId, ConnName]),
|
?ERROR("Shutdown for duplicate clientid:~s, conn:~s", [ClientId, ConnName]),
|
||||||
|
@ -78,26 +104,8 @@ handle_call(info, _From, #state{conn_name=ConnName,
|
||||||
{client_id, ClientId}],
|
{client_id, ClientId}],
|
||||||
{reply, Info, State};
|
{reply, Info, State};
|
||||||
|
|
||||||
handle_call({go, Sock}, _From, _State) ->
|
handle_call(_Req, _From, State) ->
|
||||||
process_flag(trap_exit, true),
|
{reply, ok, State}.
|
||||||
ok = throw_on_error(
|
|
||||||
inet_error, fun () -> emqtt_net:tune_buffer_size(Sock) end),
|
|
||||||
{ok, ConnStr} = emqtt_net:connection_string(Sock, inbound),
|
|
||||||
%FIXME: merge to registry
|
|
||||||
emqtt_client_monitor:mon(self()),
|
|
||||||
?ERROR("accepting connection (~s)", [ConnStr]),
|
|
||||||
{reply, ok,
|
|
||||||
control_throttle(
|
|
||||||
#state{ socket = Sock,
|
|
||||||
conn_name = ConnStr,
|
|
||||||
await_recv = false,
|
|
||||||
connection_state = running,
|
|
||||||
conserve = false,
|
|
||||||
parse_state = emqtt_frame:initial_state(),
|
|
||||||
message_id = 1,
|
|
||||||
subtopics = [],
|
|
||||||
awaiting_ack = gb_trees:empty(),
|
|
||||||
awaiting_rel = gb_trees:empty()})}.
|
|
||||||
|
|
||||||
handle_cast(Msg, State) ->
|
handle_cast(Msg, State) ->
|
||||||
{stop, {badmsg, Msg}, State}.
|
{stop, {badmsg, Msg}, State}.
|
||||||
|
@ -484,6 +492,6 @@ make_msg(#mqtt_frame{
|
||||||
qos = Qos,
|
qos = Qos,
|
||||||
topic = Topic,
|
topic = Topic,
|
||||||
dup = Dup,
|
dup = Dup,
|
||||||
message_id = MessageId,
|
msgid = MessageId,
|
||||||
payload = Payload}.
|
payload = Payload}.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,97 @@
|
||||||
|
%%-----------------------------------------------------------------------------
|
||||||
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
|
%%
|
||||||
|
%% 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.
|
||||||
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%client manager
|
||||||
-module(emqtt_cm).
|
-module(emqtt_cm).
|
||||||
|
|
||||||
%%client manager...
|
-author('feng.lee@slimchat.io').
|
||||||
|
|
||||||
|
-behaviour(gen_server).
|
||||||
|
|
||||||
|
-define(SERVER, ?MODULE).
|
||||||
|
|
||||||
|
%% ------------------------------------------------------------------
|
||||||
|
%% API Function Exports
|
||||||
|
%% ------------------------------------------------------------------
|
||||||
|
|
||||||
|
-export([start_link/0]).
|
||||||
|
|
||||||
|
-export([create/2,
|
||||||
|
destroy/1,
|
||||||
|
lookup/1]).
|
||||||
|
|
||||||
|
%% ------------------------------------------------------------------
|
||||||
|
%% gen_server Function Exports
|
||||||
|
%% ------------------------------------------------------------------
|
||||||
|
|
||||||
|
-export([init/1,
|
||||||
|
handle_call/3,
|
||||||
|
handle_cast/2,
|
||||||
|
handle_info/2,
|
||||||
|
terminate/2,
|
||||||
|
code_change/3]).
|
||||||
|
|
||||||
|
%% ------------------------------------------------------------------
|
||||||
|
%% API Function Definitions
|
||||||
|
%% ------------------------------------------------------------------
|
||||||
|
start_link() ->
|
||||||
|
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
|
||||||
|
|
||||||
|
lookup(ClientId) ->
|
||||||
|
case ets:lookup(emqtt_client, ClientId) of
|
||||||
|
[{_, Pid}] -> Pid;
|
||||||
|
[] -> undefined
|
||||||
|
end.
|
||||||
|
|
||||||
|
create(ClientId, Pid) ->
|
||||||
|
ets:insert(emqtt_client, {ClientId, Pid}).
|
||||||
|
|
||||||
|
destroy(ClientId) when is_binary(ClientId) ->
|
||||||
|
ets:delete(emqtt_client, ClientId);
|
||||||
|
|
||||||
|
destroy(Pid) when is_pid(Pid) ->
|
||||||
|
ets:match_delete(emqtt_client, {{'_', Pid}}).
|
||||||
|
|
||||||
|
%% ------------------------------------------------------------------
|
||||||
|
%% gen_server Function Definitions
|
||||||
|
%% ------------------------------------------------------------------
|
||||||
|
|
||||||
|
init(Args) ->
|
||||||
|
%on one node
|
||||||
|
ets:new(emqtt_client, [named_table, public]),
|
||||||
|
{ok, Args}.
|
||||||
|
|
||||||
|
handle_call(_Request, _From, State) ->
|
||||||
|
{reply, ok, State}.
|
||||||
|
|
||||||
|
handle_cast(_Msg, State) ->
|
||||||
|
{noreply, State}.
|
||||||
|
|
||||||
|
handle_info(_Info, State) ->
|
||||||
|
{noreply, State}.
|
||||||
|
|
||||||
|
terminate(_Reason, _State) ->
|
||||||
|
ok.
|
||||||
|
|
||||||
|
code_change(_OldVsn, State, _Extra) ->
|
||||||
|
{ok, State}.
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,30 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License at
|
%%
|
||||||
%% http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% License for the specific language governing rights and limitations
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% The Original Code is eMQTT
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%%
|
%% copies or substantial portions of the Software.
|
||||||
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
|
%%
|
||||||
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
|
%% 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_ctl).
|
-module(emqtt_ctl).
|
||||||
|
|
||||||
-include("emqtt.hrl").
|
-include("emqtt.hrl").
|
||||||
|
|
||||||
-include_lib("elog/include/elog.hrl").
|
-include("emqtt_log.hrl").
|
||||||
|
|
||||||
-export([status/1,
|
-export([status/1,
|
||||||
cluster_info/1,
|
cluster_info/1,
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
%%------------------------------------------------------------------------------
|
||||||
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
|
%%
|
||||||
|
%% 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_http).
|
||||||
|
|
||||||
|
-export([handle/1]).
|
||||||
|
|
||||||
|
handle(Req) ->
|
||||||
|
Req:not_found().
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%------------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License
|
%%
|
||||||
%% at http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% the License for the specific language governing rights and
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% limitations under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% Developer of the eMQTT Code is <ery.lee@gmail.com>
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%% Copyright (c) 2012 Ery Lee. All rights reserved.
|
%% 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_listener).
|
-module(emqtt_listener).
|
||||||
|
|
||||||
|
@ -20,59 +28,22 @@
|
||||||
binary,
|
binary,
|
||||||
{packet, raw},
|
{packet, raw},
|
||||||
{reuseaddr, true},
|
{reuseaddr, true},
|
||||||
{backlog, 128},
|
{backlog, 512},
|
||||||
{nodelay, false}
|
{nodelay, false}
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export([start/1]).
|
-export([start/1]).
|
||||||
|
|
||||||
start(Listeners) ->
|
start(Listeners) ->
|
||||||
todo.
|
[open(Listener) || Listener <- Listeners].
|
||||||
|
|
||||||
|
|
||||||
spec({Listener, SockOpts}, Callback) ->
|
open({mqtt, Port, Options}) ->
|
||||||
[tcp_listener_spec(emqtt_tcp_listener_sup, Address, SockOpts,
|
MFArgs = {emqtt_client, start_link, []},
|
||||||
mqtt, "TCP Listener", Callback) || Address <- tcp_listener_addresses(Listener)].
|
Res = esockd:listen(mqtt, Port, Options ++ ?MQTT_SOCKOPTS, MFArgs),
|
||||||
|
io:format("~p~n", [Res]);
|
||||||
|
|
||||||
tcp_listener_spec(NamePrefix, {IPAddress, Port, Family}, SocketOpts,
|
open({http, Port, Options}) ->
|
||||||
Protocol, Label, OnConnect) ->
|
MFArgs = {emqtt_http, handle, []},
|
||||||
{emqtt_net:tcp_name(NamePrefix, IPAddress, Port),
|
esockd:listen(http, Port, Options, MFArgs).
|
||||||
{tcp_listener_sup, start_link,
|
|
||||||
[IPAddress, Port, [Family | SocketOpts],
|
|
||||||
{?MODULE, listener_started, [Protocol]},
|
|
||||||
{?MODULE, listener_stopped, [Protocol]},
|
|
||||||
OnConnect, Label]},
|
|
||||||
transient, infinity, supervisor, [tcp_listener_sup]}.
|
|
||||||
|
|
||||||
tcp_listener_addresses(Port) when is_integer(Port) ->
|
|
||||||
tcp_listener_addresses_auto(Port);
|
|
||||||
tcp_listener_addresses({"auto", Port}) ->
|
|
||||||
%% Variant to prevent lots of hacking around in bash and batch files
|
|
||||||
tcp_listener_addresses_auto(Port);
|
|
||||||
tcp_listener_addresses({Host, Port}) ->
|
|
||||||
%% auto: determine family IPv4 / IPv6 after converting to IP address
|
|
||||||
tcp_listener_addresses({Host, Port, auto});
|
|
||||||
tcp_listener_addresses({Host, Port, Family0})
|
|
||||||
when is_integer(Port) andalso (Port >= 0) andalso (Port =< 65535) ->
|
|
||||||
[{IPAddress, Port, Family} ||
|
|
||||||
{IPAddress, Family} <- emqtt_net:getaddr(Host, Family0)];
|
|
||||||
tcp_listener_addresses({_Host, Port, _Family0}) ->
|
|
||||||
?ERROR("invalid port ~p - not 0..65535~n", [Port]),
|
|
||||||
throw({error, {invalid_port, Port}}).
|
|
||||||
|
|
||||||
tcp_listener_addresses_auto(Port) ->
|
|
||||||
lists:append([tcp_listener_addresses(Listener) ||
|
|
||||||
Listener <- emqtt_net:port_to_listeners(Port)]).
|
|
||||||
|
|
||||||
%--------------------------------------------
|
|
||||||
%TODO: callback
|
|
||||||
%--------------------------------------------
|
|
||||||
listener_started(Protocol, IPAddress, Port) ->
|
|
||||||
%% We need the ip to distinguish e.g. 0.0.0.0 and 127.0.0.1
|
|
||||||
%% We need the host so we can distinguish multiple instances of the above
|
|
||||||
%% in a cluster.
|
|
||||||
?INFO("tcp listener started: ~p ~p:~p", [Protocol, IPAddress, Port]).
|
|
||||||
|
|
||||||
listener_stopped(Protocol, IPAddress, Port) ->
|
|
||||||
?INFO("tcp listener stopped: ~p ~p:~p", [Protocol, IPAddress, Port]).
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,28 @@
|
||||||
|
%%-----------------------------------------------------------------------------
|
||||||
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
|
%%
|
||||||
|
%% 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_monitor).
|
-module(emqtt_monitor).
|
||||||
|
|
||||||
-include_lib("elog/include/elog.hrl").
|
-include("emqtt_log.hrl").
|
||||||
|
|
||||||
-behavior(gen_server).
|
-behavior(gen_server).
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License at
|
%%
|
||||||
%% http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% License for the specific language governing rights and limitations
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% The Original Code is eMQTT
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%%
|
%% copies or substantial portions of the Software.
|
||||||
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
|
%%
|
||||||
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
|
%% 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_net).
|
-module(emqtt_net).
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%%TODO: SHOULD BE REPLACED BY emqtt_cm.erl......
|
||||||
%% compliance with the License. You may obtain a copy of the License at
|
|
||||||
%% http://www.mozilla.org/MPL/
|
|
||||||
%%
|
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
||||||
%% License for the specific language governing rights and limitations
|
|
||||||
%% under the License.
|
|
||||||
%%
|
|
||||||
%% The Original Code is eMQTT
|
|
||||||
%%
|
|
||||||
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
|
|
||||||
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
|
|
||||||
|
|
||||||
-module(emqtt_registry).
|
-module(emqtt_registry).
|
||||||
|
|
||||||
-include("emqtt.hrl").
|
-include("emqtt.hrl").
|
||||||
|
|
||||||
-include_lib("elog/include/elog.hrl").
|
-include("emqtt_log.hrl").
|
||||||
|
|
||||||
-export([start_link/0,
|
-export([start_link/0,
|
||||||
size/0,
|
size/0,
|
||||||
|
@ -40,16 +28,16 @@
|
||||||
%%----------------------------------------------------------------------------
|
%%----------------------------------------------------------------------------
|
||||||
|
|
||||||
start_link() ->
|
start_link() ->
|
||||||
gen_server2:start_link({local, ?SERVER}, ?MODULE, [], []).
|
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
|
||||||
|
|
||||||
size() ->
|
size() ->
|
||||||
ets:info(client, size).
|
ets:info(client, size).
|
||||||
|
|
||||||
register(ClientId, Pid) ->
|
register(ClientId, Pid) ->
|
||||||
gen_server2:cast(?SERVER, {register, ClientId, Pid}).
|
gen_server:cast(?SERVER, {register, ClientId, Pid}).
|
||||||
|
|
||||||
unregister(ClientId) ->
|
unregister(ClientId) ->
|
||||||
gen_server2:cast(?SERVER, {unregister, ClientId}).
|
gen_server:cast(?SERVER, {unregister, ClientId}).
|
||||||
|
|
||||||
%%----------------------------------------------------------------------------
|
%%----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -65,7 +53,7 @@ handle_call(Req, _From, State) ->
|
||||||
handle_cast({register, ClientId, Pid}, State) ->
|
handle_cast({register, ClientId, Pid}, State) ->
|
||||||
case ets:lookup(client, ClientId) of
|
case ets:lookup(client, ClientId) of
|
||||||
[{_, {OldPid, MRef}}] ->
|
[{_, {OldPid, MRef}}] ->
|
||||||
catch gen_server2:call(OldPid, duplicate_id),
|
catch gen_server:call(OldPid, duplicate_id),
|
||||||
erlang:demonitor(MRef);
|
erlang:demonitor(MRef);
|
||||||
[] ->
|
[] ->
|
||||||
ignore
|
ignore
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License
|
%%
|
||||||
%% at http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% the License for the specific language governing rights and
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% limitations under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% Developer of the eMQTT Code is <ery.lee@gmail.com>
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%% Copyright (c) 2012 Ery Lee. All rights reserved.
|
%% 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_retained).
|
-module(emqtt_retained).
|
||||||
|
|
||||||
|
@ -34,7 +42,7 @@
|
||||||
|
|
||||||
-include("emqtt.hrl").
|
-include("emqtt.hrl").
|
||||||
|
|
||||||
-include_lib("elog/include/elog.hrl").
|
-include("emqtt_log.hrl").
|
||||||
|
|
||||||
-export([start_link/0,
|
-export([start_link/0,
|
||||||
lookup/1,
|
lookup/1,
|
||||||
|
@ -54,16 +62,16 @@
|
||||||
-record(state, {}).
|
-record(state, {}).
|
||||||
|
|
||||||
start_link() ->
|
start_link() ->
|
||||||
gen_server2:start_link({local, ?MODULE}, ?MODULE, [], []).
|
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
|
||||||
|
|
||||||
lookup(Topic) ->
|
lookup(Topic) ->
|
||||||
ets:lookup(retained_msg, Topic).
|
ets:lookup(retained_msg, Topic).
|
||||||
|
|
||||||
insert(Topic, Msg) ->
|
insert(Topic, Msg) ->
|
||||||
gen_server2:cast(?MODULE, {insert, Topic, Msg}).
|
gen_server:cast(?MODULE, {insert, Topic, Msg}).
|
||||||
|
|
||||||
delete(Topic) ->
|
delete(Topic) ->
|
||||||
gen_server2:cast(?MODULE, {delete, Topic}).
|
gen_server:cast(?MODULE, {delete, Topic}).
|
||||||
|
|
||||||
send(Topic, Client) ->
|
send(Topic, Client) ->
|
||||||
[Client ! {route, Msg} ||{_, Msg} <- lookup(Topic)].
|
[Client ! {route, Msg} ||{_, Msg} <- lookup(Topic)].
|
||||||
|
|
|
@ -1,28 +1,37 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License
|
%%
|
||||||
%% at http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% the License for the specific language governing rights and
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% limitations under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% Developer of the eMQTT Code is <ery.lee@gmail.com>
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%% Copyright (c) 2012 Ery Lee. All rights reserved.
|
%% 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_router).
|
-module(emqtt_router).
|
||||||
|
|
||||||
-include("emqtt.hrl").
|
-include("emqtt.hrl").
|
||||||
|
|
||||||
|
-include("emqtt_log.hrl").
|
||||||
|
|
||||||
-include("emqtt_frame.hrl").
|
-include("emqtt_frame.hrl").
|
||||||
|
|
||||||
-include("emqtt_internal.hrl").
|
-include("emqtt_internal.hrl").
|
||||||
|
|
||||||
-include_lib("stdlib/include/qlc.hrl").
|
-include_lib("stdlib/include/qlc.hrl").
|
||||||
|
|
||||||
-include_lib("elog/include/elog.hrl").
|
|
||||||
|
|
||||||
-export([start_link/0]).
|
-export([start_link/0]).
|
||||||
|
|
||||||
-export([topics/0,
|
-export([topics/0,
|
||||||
|
@ -46,16 +55,16 @@
|
||||||
-record(state, {}).
|
-record(state, {}).
|
||||||
|
|
||||||
start_link() ->
|
start_link() ->
|
||||||
gen_server2:start_link({local, ?MODULE}, ?MODULE, [], []).
|
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
|
||||||
|
|
||||||
topics() ->
|
topics() ->
|
||||||
mnesia:dirty_all_keys(topic).
|
mnesia:dirty_all_keys(topic).
|
||||||
|
|
||||||
subscribe({Topic, Qos}, Client) when is_pid(Client) ->
|
subscribe({Topic, Qos}, Client) when is_pid(Client) ->
|
||||||
gen_server2:call(?MODULE, {subscribe, {Topic, Qos}, Client}).
|
gen_server:call(?MODULE, {subscribe, {Topic, Qos}, Client}).
|
||||||
|
|
||||||
unsubscribe(Topic, Client) when is_list(Topic) and is_pid(Client) ->
|
unsubscribe(Topic, Client) when is_list(Topic) and is_pid(Client) ->
|
||||||
gen_server2:cast(?MODULE, {unsubscribe, Topic, Client}).
|
gen_server:cast(?MODULE, {unsubscribe, Topic, Client}).
|
||||||
|
|
||||||
publish(Msg=#mqtt_msg{topic=Topic}) ->
|
publish(Msg=#mqtt_msg{topic=Topic}) ->
|
||||||
publish(Topic, Msg).
|
publish(Topic, Msg).
|
||||||
|
@ -80,7 +89,7 @@ match(Topic) when is_list(Topic) ->
|
||||||
|
|
||||||
%TODO: this api is really ugly
|
%TODO: this api is really ugly
|
||||||
down(Client) when is_pid(Client) ->
|
down(Client) when is_pid(Client) ->
|
||||||
gen_server2:cast(?MODULE, {down, Client}).
|
gen_server:cast(?MODULE, {down, Client}).
|
||||||
|
|
||||||
init([]) ->
|
init([]) ->
|
||||||
mnesia:create_table(trie, [
|
mnesia:create_table(trie, [
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License at
|
%%
|
||||||
%% http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% License for the specific language governing rights and limitations
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% The Original Code is eMQTT
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%%
|
%% copies or substantial portions of the Software.
|
||||||
%% The Initial Developer of the Original Code is <ery.lee at gmail dot com>
|
%%
|
||||||
%% Copyright (C) 2012 Ery Lee All Rights Reserved.
|
%% 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_sup).
|
-module(emqtt_sup).
|
||||||
|
|
||||||
|
@ -20,7 +27,7 @@
|
||||||
-behaviour(supervisor).
|
-behaviour(supervisor).
|
||||||
|
|
||||||
%% API
|
%% API
|
||||||
-export([start_link/1,
|
-export([start_link/0,
|
||||||
start_child/1,
|
start_child/1,
|
||||||
start_child/2]).
|
start_child/2]).
|
||||||
|
|
||||||
|
@ -33,9 +40,8 @@
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
%% API functions
|
%% API functions
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
start_link(Listeners) ->
|
start_link() ->
|
||||||
supervisor:start_link({local, ?MODULE}, ?MODULE, [Listeners]).
|
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
||||||
|
|
||||||
|
|
||||||
start_child(ChildSpec) when is_tuple(ChildSpec) ->
|
start_child(ChildSpec) when is_tuple(ChildSpec) ->
|
||||||
supervisor:start_child(?MODULE, ChildSpec).
|
supervisor:start_child(?MODULE, ChildSpec).
|
||||||
|
@ -51,26 +57,14 @@ start_child(Mod, Type) when is_atom(Mod) and is_atom(Type) ->
|
||||||
%% Supervisor callbacks
|
%% Supervisor callbacks
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
init([Listeners]) ->
|
init([]) ->
|
||||||
Listeners2 = lists:map(fun({Port, Args}) ->
|
|
||||||
{Port, Args};
|
|
||||||
({Port, Size, Args}) ->
|
|
||||||
[{Port+I, Args} || I <- lists:seq(0,Size)]
|
|
||||||
end, Listeners),
|
|
||||||
|
|
||||||
{ok, { {one_for_all, 5, 10}, [
|
{ok, { {one_for_all, 5, 10}, [
|
||||||
|
?CHILD(emqtt_cm, worker),
|
||||||
?CHILD(emqtt_monitor, worker),
|
?CHILD(emqtt_monitor, worker),
|
||||||
?CHILD(emqtt_auth, worker),
|
?CHILD(emqtt_auth, worker),
|
||||||
?CHILD(emqtt_retained, worker),
|
?CHILD(emqtt_retained, worker),
|
||||||
|
?CHILD(emqtt_pubsub, worker),
|
||||||
?CHILD(emqtt_router, worker),
|
?CHILD(emqtt_router, worker),
|
||||||
?CHILD(emqtt_registry, worker),
|
?CHILD(emqtt_registry, worker)]}
|
||||||
?CHILD(emqtt_client_monitor, worker),
|
|
||||||
?CHILD(emqtt_client_sup, supervisor)
|
|
||||||
| listener_children(lists:flatten(Listeners2)) ]}
|
|
||||||
}.
|
}.
|
||||||
|
|
||||||
listener_children(Listeners) ->
|
|
||||||
lists:append([emqtt_listener:spec(Listener,
|
|
||||||
{emqtt_client_sup, start_client, []}) || Listener <- Listeners]).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
%% The contents of this file are subject to the Mozilla Public License
|
%%-----------------------------------------------------------------------------
|
||||||
%% Version 1.1 (the "License"); you may not use this file except in
|
%% Copyright (c) 2014, Feng Lee <feng.lee@slimchat.io>
|
||||||
%% compliance with the License. You may obtain a copy of the License
|
%%
|
||||||
%% at http://www.mozilla.org/MPL/
|
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
%%
|
%% of this software and associated documentation files (the "Software"), to deal
|
||||||
%% Software distributed under the License is distributed on an "AS IS"
|
%% in the Software without restriction, including without limitation the rights
|
||||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
%% the License for the specific language governing rights and
|
%% copies of the Software, and to permit persons to whom the Software is
|
||||||
%% limitations under the License.
|
%% furnished to do so, subject to the following conditions:
|
||||||
%%
|
%%
|
||||||
%% Developer of the eMQTT Code is <ery.lee@gmail.com>
|
%% The above copyright notice and this permission notice shall be included in all
|
||||||
%% Copyright (c) 2012 Ery Lee. All rights reserved.
|
%% 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_topic).
|
-module(emqtt_topic).
|
||||||
|
|
||||||
-import(lists, [reverse/1]).
|
-import(lists, [reverse/1]).
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{sasl_error_logger, {file, "log/emqtt_sasl.log"}}
|
{sasl_error_logger, {file, "log/emqtt_sasl.log"}}
|
||||||
]},
|
]},
|
||||||
{mnesia, [
|
{mnesia, [
|
||||||
{dir, "var/data"}
|
{dir, "data"}
|
||||||
]},
|
]},
|
||||||
{lager, [
|
{lager, [
|
||||||
{error_logger_redirect, false},
|
{error_logger_redirect, false},
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
{sys, [
|
{sys, [
|
||||||
{lib_dirs, ["../..", "../lib", "../plugins"]},
|
{lib_dirs, ["../apps", "../deps", "../plugins"]},
|
||||||
{erts, [{mod_cond, derived}, {app_file, strip}]},
|
{erts, [{mod_cond, derived}, {app_file, strip}]},
|
||||||
{app_file, strip},
|
{app_file, strip},
|
||||||
{rel, "emqtt", "0.1.5",
|
{rel, "emqtt", "0.2.0",
|
||||||
[
|
[
|
||||||
kernel,
|
kernel,
|
||||||
stdlib,
|
stdlib,
|
||||||
sasl,
|
sasl,
|
||||||
|
syntax_tools,
|
||||||
|
ssl,
|
||||||
|
crypto,
|
||||||
mnesia,
|
mnesia,
|
||||||
bear,
|
os_mon,
|
||||||
|
inets,
|
||||||
goldrush,
|
goldrush,
|
||||||
lager,
|
lager,
|
||||||
syntax_tools,
|
esockd,
|
||||||
elog,
|
mochiweb,
|
||||||
compiler,
|
|
||||||
gs,
|
|
||||||
runtime_tools,
|
|
||||||
appmon,
|
|
||||||
{folsom, load},
|
|
||||||
emqtt
|
emqtt
|
||||||
]},
|
]},
|
||||||
{rel, "start_clean", "",
|
{rel, "start_clean", "",
|
||||||
|
@ -27,26 +26,27 @@
|
||||||
]},
|
]},
|
||||||
{boot_rel, "emqtt"},
|
{boot_rel, "emqtt"},
|
||||||
{profile, embedded},
|
{profile, embedded},
|
||||||
{incl_cond, exclude},
|
{incl_cond, derived},
|
||||||
%{mod_cond, derived},
|
%{mod_cond, derived},
|
||||||
{excl_archive_filters, [".*"]}, %% Do not archive built libs
|
{excl_archive_filters, [".*"]}, %% Do not archive built libs
|
||||||
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
|
{excl_sys_filters, ["^bin/(?!start_clean.boot)",
|
||||||
|
"^erts.*/bin/(dialyzer|typer)",
|
||||||
"^erts.*/(doc|info|include|lib|man|src)"]},
|
"^erts.*/(doc|info|include|lib|man|src)"]},
|
||||||
{excl_app_filters, ["\.gitignore"]},
|
{excl_app_filters, ["\.gitignore"]},
|
||||||
{app, kernel, [{incl_cond, include}]},
|
{app, kernel, [{incl_cond, include}]},
|
||||||
{app, stdlib, [{incl_cond, include}]},
|
{app, stdlib, [{incl_cond, include}]},
|
||||||
{app, sasl, [{incl_cond, include}]},
|
{app, sasl, [{incl_cond, include}]},
|
||||||
{app, mnesia, [{incl_cond, include}]},
|
{app, crypto, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, compiler, [{incl_cond, include}]},
|
{app, ssl, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, bear, [{incl_cond, include}]},
|
{app, os_mon, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, goldrush, [{incl_cond, include}]},
|
{app, syntax_tools, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, lager, [{incl_cond, include}]},
|
{app, public_key, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, elog, [{incl_cond, include}]},
|
{app, mnesia, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, gs, [{incl_cond, include}]},
|
{app, inets, [{mod_cond, app},{incl_cond, include}]},
|
||||||
{app, runtime_tools, [{incl_cond, include}]},
|
{app, goldrush, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, appmon, [{incl_cond, include}]},
|
{app, lager, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, syntax_tools, [{incl_cond, include}]},
|
{app, esockd, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, folsom, [{incl_cond, include}]},
|
{app, mochiweb, [{mod_cond, app}, {incl_cond, include}]},
|
||||||
{app, emqtt, [{mod_cond, app}, {incl_cond, include}]}
|
{app, emqtt, [{mod_cond, app}, {incl_cond, include}]}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
{overlay, [
|
{overlay, [
|
||||||
{mkdir, "log/"},
|
{mkdir, "log/"},
|
||||||
{mkdir, "etc/"},
|
{mkdir, "etc/"},
|
||||||
{mkdir, "var/data/"},
|
{mkdir, "data/"},
|
||||||
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
|
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
|
||||||
{template, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
|
{template, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
|
||||||
{template, "files/emqtt", "bin/emqtt"},
|
{template, "files/emqtt", "bin/emqtt"},
|
||||||
|
|
Loading…
Reference in New Issue