fix(gw-stomp): unify the hearbeat type name
This commit is contained in:
parent
c36cdf9682
commit
a116c0afd1
|
@ -758,7 +758,7 @@ handle_timeout(_TRef, {keepalive_send, NewVal},
|
||||||
{error, timeout} ->
|
{error, timeout} ->
|
||||||
NHrtBt = emqx_stomp_heartbeat:reset(outgoing, NewVal, HrtBt),
|
NHrtBt = emqx_stomp_heartbeat:reset(outgoing, NewVal, HrtBt),
|
||||||
NChannel = Channel#channel{heartbeat = NHrtBt},
|
NChannel = Channel#channel{heartbeat = NHrtBt},
|
||||||
{ok, {outgoing, emqx_stomp_frame:make(heartbeat)},
|
{ok, {outgoing, emqx_stomp_frame:make(?CMD_HEARTBEAT)},
|
||||||
reset_timer(outgoing_timer, NChannel)};
|
reset_timer(outgoing_timer, NChannel)};
|
||||||
{ok, NHrtBt} ->
|
{ok, NHrtBt} ->
|
||||||
{ok, reset_timer(outgoing_timer,
|
{ok, reset_timer(outgoing_timer,
|
||||||
|
|
|
@ -242,7 +242,7 @@ unescape(_Ch) -> error(cannnot_unescape).
|
||||||
serialize_opts() ->
|
serialize_opts() ->
|
||||||
#{}.
|
#{}.
|
||||||
|
|
||||||
serialize_pkt(#stomp_frame{command = heartbeat}, _SerializeOpts) ->
|
serialize_pkt(#stomp_frame{command = ?CMD_HEARTBEAT}, _SerializeOpts) ->
|
||||||
<<$\n>>;
|
<<$\n>>;
|
||||||
|
|
||||||
serialize_pkt(#stomp_frame{command = Cmd, headers = Headers, body = Body},
|
serialize_pkt(#stomp_frame{command = Cmd, headers = Headers, body = Body},
|
||||||
|
@ -279,8 +279,8 @@ new_state(#parser_state{limit = Limit}) ->
|
||||||
|
|
||||||
%% @doc Make a frame
|
%% @doc Make a frame
|
||||||
|
|
||||||
make(heartbeat) ->
|
make(?CMD_HEARTBEAT) ->
|
||||||
#stomp_frame{command = heartbeat}.
|
#stomp_frame{command = ?CMD_HEARTBEAT}.
|
||||||
|
|
||||||
make(<<"CONNECTED">>, Headers) ->
|
make(<<"CONNECTED">>, Headers) ->
|
||||||
#stomp_frame{command = <<"CONNECTED">>,
|
#stomp_frame{command = <<"CONNECTED">>,
|
||||||
|
@ -317,4 +317,5 @@ type(?CMD_DISCONNECT) -> disconnect;
|
||||||
type(?CMD_CONNECTED) -> connected;
|
type(?CMD_CONNECTED) -> connected;
|
||||||
type(?CMD_MESSAGE) -> message;
|
type(?CMD_MESSAGE) -> message;
|
||||||
type(?CMD_RECEIPT) -> receipt;
|
type(?CMD_RECEIPT) -> receipt;
|
||||||
type(?CMD_ERROR) -> error.
|
type(?CMD_ERROR) -> error;
|
||||||
|
type(?CMD_HEARTBEAT) -> heartbeat.
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
-define(CMD_MESSAGE, <<"MESSAGE">>).
|
-define(CMD_MESSAGE, <<"MESSAGE">>).
|
||||||
-define(CMD_RECEIPT, <<"RECEIPT">>).
|
-define(CMD_RECEIPT, <<"RECEIPT">>).
|
||||||
-define(CMD_ERROR, <<"ERROR">>).
|
-define(CMD_ERROR, <<"ERROR">>).
|
||||||
|
-define(CMD_HEARTBEAT, <<"HEARTBEAT">>).
|
||||||
|
|
||||||
%-type client_command() :: ?CMD_SEND | ?CMD_SUBSCRIBE | ?CMD_UNSUBSCRIBE
|
%-type client_command() :: ?CMD_SEND | ?CMD_SUBSCRIBE | ?CMD_UNSUBSCRIBE
|
||||||
% | ?CMD_BEGIN | ?CMD_COMMIT | ?CMD_ABORT | ?CMD_ACK
|
% | ?CMD_BEGIN | ?CMD_COMMIT | ?CMD_ABORT | ?CMD_ACK
|
||||||
|
@ -53,7 +54,7 @@
|
||||||
|
|
||||||
%-type server_command() :: ?CMD_CONNECTED | ?CMD_MESSAGE | ?CMD_RECEIPT
|
%-type server_command() :: ?CMD_CONNECTED | ?CMD_MESSAGE | ?CMD_RECEIPT
|
||||||
% | ?CMD_ERROR.
|
% | ?CMD_ERROR.
|
||||||
-type server_command() :: binary() | heartbeat.
|
-type server_command() :: binary().
|
||||||
|
|
||||||
-record(stomp_frame, {
|
-record(stomp_frame, {
|
||||||
command :: client_command() | server_command(),
|
command :: client_command() | server_command(),
|
||||||
|
|
Loading…
Reference in New Issue