Merge pull request #795 from emqtt/emq20

ws metrics
This commit is contained in:
Feng Lee 2016-12-06 09:51:16 +08:00 committed by GitHub
commit d2bb3925a0
2 changed files with 2 additions and 0 deletions

View File

@ -55,6 +55,7 @@ ws_loop([<<>>], State, _ReplyChannel) ->
ws_loop(Data, State = #wsocket_state{peer = Peer, client_pid = ClientPid,
parser_fun = ParserFun}, ReplyChannel) ->
?WSLOG(debug, Peer, "RECV ~p", [Data]),
emqttd_metrics:inc('bytes/received', size(Data)),
case catch ParserFun(iolist_to_binary(Data)) of
{more, NewParser} ->
State#wsocket_state{parser_fun = NewParser};

View File

@ -107,6 +107,7 @@ handle_cast({unsubscribe, Topics}, State) ->
end, State);
handle_cast({received, Packet}, State = #wsclient_state{peer = Peer, proto_state = ProtoState}) ->
emqttd_metrics:received(Packet),
case emqttd_protocol:received(Packet, ProtoState) of
{ok, ProtoState1} ->
noreply(State#wsclient_state{proto_state = ProtoState1});