fix(ping): deny pingreq when mqtt not connected
This commit is contained in:
parent
9e5a868bf1
commit
198da2c688
|
@ -343,9 +343,6 @@ handle_msg({incoming, Packet = ?CONNECT_PACKET(ConnPkt)},
|
|||
},
|
||||
handle_incoming(Packet, NState);
|
||||
|
||||
handle_msg({incoming, ?PACKET(?PINGREQ)}, State) ->
|
||||
handle_outgoing(?PACKET(?PINGRESP), State);
|
||||
|
||||
handle_msg({incoming, Packet}, State) ->
|
||||
handle_incoming(Packet, State);
|
||||
|
||||
|
|
|
@ -296,9 +296,6 @@ websocket_info({incoming, Packet = ?CONNECT_PACKET(ConnPkt)}, State) ->
|
|||
NState = State#state{serialize = Serialize},
|
||||
handle_incoming(Packet, cancel_idle_timer(NState));
|
||||
|
||||
websocket_info({incoming, ?PACKET(?PINGREQ)}, State) ->
|
||||
return(enqueue(?PACKET(?PINGRESP), State));
|
||||
|
||||
websocket_info({incoming, Packet}, State) ->
|
||||
handle_incoming(Packet, State);
|
||||
|
||||
|
|
|
@ -165,7 +165,6 @@ t_handle_msg(_) ->
|
|||
|
||||
t_handle_msg_incoming(_) ->
|
||||
?assertMatch({ok, _Out, _St}, emqx_connection:handle_msg({incoming, ?CONNECT_PACKET(#mqtt_packet_connect{})}, st())),
|
||||
?assertEqual(ok, emqx_connection:handle_msg({incoming, ?PACKET(?PINGREQ)}, st())),
|
||||
ok = meck:expect(emqx_channel, handle_in, fun(_Packet, Channel) -> {ok, Channel} end),
|
||||
?assertMatch({ok, _St}, emqx_connection:handle_msg({incoming, ?PUBLISH_PACKET(?QOS_1, <<"t">>, 1, <<"payload">>)}, st())),
|
||||
?assertMatch({ok, _St}, emqx_connection:handle_msg({incoming, <<?SUBSCRIBE:4,2:4,11,0,2,0,6,84,111,112,105,99,65,2>>}, st())),
|
||||
|
|
Loading…
Reference in New Issue