From 760287e78a41cb97244a8774a01fee9a1b546f02 Mon Sep 17 00:00:00 2001 From: anlicheng Date: Mon, 19 Jun 2023 14:45:13 +0800 Subject: [PATCH] fix host --- apps/iot/src/iot_host.erl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index ad70a47..61d0fa9 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -178,6 +178,12 @@ handle_event({call, From}, has_session, StateName, State) -> HasSession = (StateName =:= session) orelse false, {keep_state, State, [{reply, From, HasSession}]}; +handle_event({call, From}, {make_assoc, ReceiverPid}, _, State = #state{uuid = UUID, increment_id = IncrementId, assoc_map = AssocMap}) -> + BinIncrementId = erlang:integer_to_binary(IncrementId), + Assoc = <>, + + {keep_state, State#state{assoc_map = maps:put(Assoc, ReceiverPid, AssocMap), increment_id = IncrementId + 1}, [{reply, From, {ok, Assoc}}]}; + %% 基于rsa加密 handle_event({call, From}, {rsa_encode, CommandType, PlainText}, session, State = #state{pub_key = PubKey}) -> Reply = iot_cipher_rsa:encode(PlainText, PubKey),