This commit is contained in:
anlicheng 2023-08-10 16:07:22 +08:00
parent 0b43bd8c13
commit 8231ef42b4

View File

@ -223,10 +223,10 @@ handle_event({call, From}, {create_session, PubKey}, denied, State = #state{uuid
{keep_state, State, [{reply, From, {ok, <<10:8, EncReply/binary>>}}]};
handle_event({call, From}, {create_session, PubKey}, StateName, State = #state{uuid = UUID, aes = Aes}) ->
lager:debug("[iot_host] host_id(~p) uuid: ~p, create_session, will change status", [StateName, UUID]),
Reply = #{<<"a">> => true, <<"aes">> => Aes},
EncReply = iot_cipher_rsa:encode(Reply, PubKey),
{ok, _} = host_bo:change_status(UUID, ?HOST_STATUS_ONLINE),
{ok, AffectedRow} = host_bo:change_status(UUID, ?HOST_STATUS_ONLINE),
lager:debug("[iot_host] host_id(~p) uuid: ~p, create_session, will change status, affected_row: ~p", [StateName, UUID, AffectedRow]),
{next_state, session, State, [{reply, From, {ok, <<10:8, EncReply/binary>>}}]};