Delete redundant case clauses in sendfun

Prior to this change, there are ok, {binary, _Data}. {datagram, _Peer,
_Dara} case clauses, and the {binary, _Data} and {datagram, _Peer,
_Data} are unnecessary cases

This change delete these two cases and add ok in the end of funtion in
send_fun of emqx_ws_connection.
This commit is contained in:
Gilbert Wong 2018-11-03 22:56:11 +08:00
parent 58f5f3c51b
commit 4ea57c2bf9
2 changed files with 2 additions and 7 deletions

View File

@ -593,12 +593,6 @@ send(Packet = ?PACKET(Type), PState = #pstate{proto_ver = Ver, sendfun = SendFun
ok ->
emqx_metrics:sent(Packet),
{ok, inc_stats(send, Type, PState)};
{binary, _Data} ->
emqx_metrics:sent(Packet),
{ok, inc_stats(send, Type, PState)};
{datagram, _Peer, _Data} ->
emqx_metrics:sent(Packet),
{ok, inc_stats(send, Type, PState)};
{error, Reason} ->
{error, Reason}
end.

View File

@ -150,7 +150,8 @@ send_fun(WsPid) ->
emqx_metrics:inc('bytes/sent', BinSize),
put(send_oct, get(send_oct) + BinSize),
put(send_cnt, get(send_cnt) + 1),
WsPid ! {binary, iolist_to_binary(Data)}
WsPid ! {binary, iolist_to_binary(Data)},
ok
end.
stat_fun() ->