Msg =
This commit is contained in:
parent
e05f0cb5b1
commit
2d1066517f
|
@ -172,7 +172,7 @@ cast(Msg) ->
|
||||||
%% @end
|
%% @end
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
-spec publish(Msg :: mqtt_message()) -> ok.
|
-spec publish(Msg :: mqtt_message()) -> ok.
|
||||||
publish(#mqtt_message{from = From} = Msg) ->
|
publish(Msg = #mqtt_message{from = From}) ->
|
||||||
trace(publish, From, Msg),
|
trace(publish, From, Msg),
|
||||||
Msg1 = #mqtt_message{topic = Topic}
|
Msg1 = #mqtt_message{topic = Topic}
|
||||||
= emqttd_broker:foldl_hooks('message.publish', [], Msg),
|
= emqttd_broker:foldl_hooks('message.publish', [], Msg),
|
||||||
|
@ -186,7 +186,7 @@ publish(#mqtt_message{from = From} = Msg) ->
|
||||||
publish(Topic, Msg1)
|
publish(Topic, Msg1)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
publish(<<"$Q/", _/binary>> = Queue, #mqtt_message{qos = Qos} = Msg) ->
|
publish(Queue = <<"$Q/", _/binary>>, Msg = #mqtt_message{qos = Qos}) ->
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(#mqtt_queue{qpid = QPid, qos = SubQos}) ->
|
fun(#mqtt_queue{qpid = QPid, qos = SubQos}) ->
|
||||||
Msg1 = if
|
Msg1 = if
|
||||||
|
@ -209,7 +209,7 @@ publish(Topic, Msg) when is_binary(Topic) ->
|
||||||
%% @end
|
%% @end
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
-spec dispatch(Topic :: binary(), Msg :: mqtt_message()) -> non_neg_integer().
|
-spec dispatch(Topic :: binary(), Msg :: mqtt_message()) -> non_neg_integer().
|
||||||
dispatch(Topic, #mqtt_message{qos = Qos} = Msg ) when is_binary(Topic) ->
|
dispatch(Topic, Msg = #mqtt_message{qos = Qos}) when is_binary(Topic) ->
|
||||||
Subscribers = mnesia:dirty_read(subscriber, Topic),
|
Subscribers = mnesia:dirty_read(subscriber, Topic),
|
||||||
setstats(dropped, Subscribers =:= []),
|
setstats(dropped, Subscribers =:= []),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
|
|
Loading…
Reference in New Issue