diff --git a/src/emqttd.app.src b/src/emqttd.app.src index 4e77ea1bb..9a6abc4ce 100644 --- a/src/emqttd.app.src +++ b/src/emqttd.app.src @@ -6,7 +6,9 @@ {modules, []}, {registered, []}, {applications, [kernel, - stdlib]}, + stdlib, + gproc, + esockd]}, {mod, {emqttd_app, []}}, {env, []} ]}. diff --git a/src/emqttd_pubsub.erl b/src/emqttd_pubsub.erl index 8ca3b88ab..31823b8da 100644 --- a/src/emqttd_pubsub.erl +++ b/src/emqttd_pubsub.erl @@ -186,6 +186,24 @@ init([Pool, Id, _Opts]) -> ?GPROC_POOL(join, Pool, Id), {ok, #state{pool = Pool, id = Id}}. +prioritise_call(Msg, _From, _Len, _State) -> + case Msg of + {subscribe, _, _} -> 1; + _ -> 0 + end. + +prioritise_cast(Msg, _Len, _State) -> + case Msg of + {unsubscribe, _, _} -> 2; + _ -> 0 + end. + +prioritise_info(Msg, _Len, _State) -> + case Msg of + {'DOWN', _, _, _, _} -> 3; + _ -> 0 + end. + %%TODO: clientId??? handle_call({subscribe, _SubPid, TopicTable}, _From, State) -> Records = [#mqtt_topic{topic = Topic, node = node()} || {Topic, _Qos} <- TopicTable],