Fix the merge conflicts
This commit is contained in:
parent
45eee42c76
commit
a9daa3c821
|
@ -334,26 +334,23 @@ handle_in(Packet = ?UNSUBSCRIBE_PACKET(PacketId, Properties, TopicFilters),
|
||||||
handle_in(?PACKET(?PINGREQ), Channel) ->
|
handle_in(?PACKET(?PINGREQ), Channel) ->
|
||||||
{ok, ?PACKET(?PINGRESP), Channel};
|
{ok, ?PACKET(?PINGRESP), Channel};
|
||||||
|
|
||||||
handle_in(?DISCONNECT_PACKET(ReasonCode, Properties), Channel = #channel{session = Session,
|
handle_in(?DISCONNECT_PACKET(ReasonCode, Properties), Channel = #channel{conninfo = ConnInfo}) ->
|
||||||
conninfo = ConnInfo = #{expiry_interval := OldInterval}}) ->
|
#{proto_ver := ProtoVer, expiry_interval := OldInterval} = ConnInfo,
|
||||||
OldInterval = emqx_session:info(expiry_interval, Session),
|
Interval = emqx_mqtt_props:get('Session-Expiry-Interval', Properties, OldInterval),
|
||||||
Interval = emqx_mqtt_props:get('Session-Expiry-Interval', Props, OldInterval),
|
|
||||||
case OldInterval =:= 0 andalso Interval =/= OldInterval of
|
case OldInterval =:= 0 andalso Interval =/= OldInterval of
|
||||||
true ->
|
true ->
|
||||||
handle_out({disconnect, ?RC_PROTOCOL_ERROR}, Channel);
|
handle_out({disconnect, ?RC_PROTOCOL_ERROR}, Channel);
|
||||||
false ->
|
false ->
|
||||||
Reason = case ReasonCode of
|
Reason = case ReasonCode of
|
||||||
?RC_SUCCESS -> normal;
|
?RC_SUCCESS -> normal;
|
||||||
_ ->
|
_ -> emqx_reason_codes:name(ReasonCode, ProtoVer)
|
||||||
ProtoVer = emqx_protocol:info(proto_ver, Protocol),
|
|
||||||
emqx_reason_codes:name(ReasonCode, ProtoVer)
|
|
||||||
end,
|
end,
|
||||||
{wait_session_expire, {shutdown, Reason},
|
Channel1 = Channel#channel{conninfo = ConnInfo#{expiry_interval := Interval}},
|
||||||
Channel#channel{session = emqx_session:update_expiry_interval(Interval, Session),
|
Channel2 = case ReasonCode of
|
||||||
protocol = case ReasonCode of
|
?RC_SUCCESS -> Channel1#channel{will_msg = undefined};
|
||||||
?RC_SUCCESS -> emqx_protocol:clear_will_msg(Protocol);
|
_ -> Channel1
|
||||||
_ -> Protocol
|
end,
|
||||||
end}}
|
{wait_session_expire, {shutdown, Reason}, Channel2}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
handle_in(?AUTH_PACKET(), Channel) ->
|
handle_in(?AUTH_PACKET(), Channel) ->
|
||||||
|
@ -694,7 +691,6 @@ handle_info(disconnected, Channel = #channel{connected = false}) ->
|
||||||
|
|
||||||
handle_info(disconnected, Channel = #channel{conninfo = #{expiry_interval := ExpiryInterval},
|
handle_info(disconnected, Channel = #channel{conninfo = #{expiry_interval := ExpiryInterval},
|
||||||
client = ClientInfo = #{zone := Zone},
|
client = ClientInfo = #{zone := Zone},
|
||||||
session = Session,
|
|
||||||
will_msg = WillMsg}) ->
|
will_msg = WillMsg}) ->
|
||||||
emqx_zone:enable_flapping_detect(Zone) andalso emqx_flapping:detect(ClientInfo),
|
emqx_zone:enable_flapping_detect(Zone) andalso emqx_flapping:detect(ClientInfo),
|
||||||
Channel1 = ensure_disconnected(Channel),
|
Channel1 = ensure_disconnected(Channel),
|
||||||
|
@ -835,16 +831,12 @@ will_delay_interval(WillMsg) ->
|
||||||
|
|
||||||
terminate(normal, #channel{conninfo = ConnInfo, client = ClientInfo}) ->
|
terminate(normal, #channel{conninfo = ConnInfo, client = ClientInfo}) ->
|
||||||
ok = emqx_hooks:run('client.disconnected', [ClientInfo, normal, ConnInfo]);
|
ok = emqx_hooks:run('client.disconnected', [ClientInfo, normal, ConnInfo]);
|
||||||
terminate({shutdown, Reason}, #channel{conninfo = ConnInfo, client = ClientInfo,})
|
terminate({shutdown, Reason}, #channel{conninfo = ConnInfo, client = ClientInfo})
|
||||||
when Reason =:= kicked orelse Reason =:= discarded orelse Reason =:= takeovered ->
|
when Reason =:= kicked orelse Reason =:= discarded orelse Reason =:= takeovered ->
|
||||||
ok = emqx_hooks:run('client.disconnected', [ClientInfo, Reason, ConnInfo]);
|
ok = emqx_hooks:run('client.disconnected', [ClientInfo, Reason, ConnInfo]);
|
||||||
terminate(Reason, #channel{conninfo = ConnInfo, client = ClientInfo, will_msg = WillMsg}) ->
|
terminate(Reason, #channel{conninfo = ConnInfo, client = ClientInfo, will_msg = WillMsg}) ->
|
||||||
publish_will_msg(WillMsg),
|
publish_will_msg(WillMsg),
|
||||||
ok = emqx_hooks:run('client.disconnected', [ClientInfo, Reason, ConnInfo]).
|
ok = emqx_hooks:run('client.disconnected', [ClientInfo, Reason, ConnInfo]).
|
||||||
if
|
|
||||||
Protocol == undefined -> ok;
|
|
||||||
true -> publish_will_msg(emqx_protocol:info(will_msg, Protocol))
|
|
||||||
end.
|
|
||||||
|
|
||||||
-spec(received(pos_integer(), channel()) -> channel()).
|
-spec(received(pos_integer(), channel()) -> channel()).
|
||||||
received(Oct, Channel) ->
|
received(Oct, Channel) ->
|
||||||
|
|
|
@ -360,8 +360,7 @@ handle_timeout(TRef, Msg, State = #ws_connection{chan_state = ChanState}) ->
|
||||||
process_incoming(<<>>, State) ->
|
process_incoming(<<>>, State) ->
|
||||||
{ok, State};
|
{ok, State};
|
||||||
|
|
||||||
process_incoming(Data, State = #ws_connection{parse_state = ParseState,
|
process_incoming(Data, State = #ws_connection{parse_state = ParseState}) ->
|
||||||
chan_state = ChanState}) ->
|
|
||||||
try emqx_frame:parse(Data, ParseState) of
|
try emqx_frame:parse(Data, ParseState) of
|
||||||
{more, NParseState} ->
|
{more, NParseState} ->
|
||||||
{ok, State#ws_connection{parse_state = NParseState}};
|
{ok, State#ws_connection{parse_state = NParseState}};
|
||||||
|
|
Loading…
Reference in New Issue