fix buffer

This commit is contained in:
anlicheng 2023-09-25 17:37:13 +08:00
parent 2ca06f97fe
commit 7f0b5e546c

View File

@ -66,7 +66,12 @@ init([]) ->
{stop, Reason :: term(), Reply :: term(), NewState :: #state{}} |
{stop, Reason :: term(), NewState :: #state{}}).
handle_call({find_device, DeviceUUID}, _From, State = #state{devices_map = DevicesMap}) ->
{reply, maps:find(DeviceUUID, DevicesMap), State}.
case maps:take(DeviceUUID, DevicesMap) of
error ->
{reply, error, State};
{DeviceInfo, NDevicesMap} ->
{reply, {ok, DeviceInfo}, State#state{devices_map = NDevicesMap}}
end.
%% @private
%% @doc Handling cast messages