fix regedit

This commit is contained in:
anlicheng 2025-12-13 21:29:54 +08:00
parent 6d2f9d52c3
commit 11e559b76b
2 changed files with 8 additions and 3 deletions

View File

@ -27,6 +27,6 @@ lookup(FullHostname) when is_binary(FullHostname) ->
end.
-spec insert(FullHostname :: binary(), Ip :: integer()) -> no_return().
insert(FullHostname, Ip) when is_integer(FullHostname) ->
insert(FullHostname, Ip) when is_binary(FullHostname), is_integer(Ip) ->
<<Ip0, Ip1, Ip2, Ip3>> = <<Ip:32>>,
true = ets:insert(?TABLE, {FullHostname, {Ip0, Ip1, Ip2, Ip3}}).

View File

@ -232,8 +232,13 @@ handle_call({assign_ip_addr, ChannelPid, ClientId, Mac, NetAddr0, HostName}, _Fr
maybe_close_channel(maps:get(Mac, UsedMap, undefined)),
%% ->ip的映射关系
case HostName =/= <<>> of
true ->
FullHostname = <<HostName/binary, ".", Domain/binary>>,
sdlan_hostname_regedit:insert(FullHostname, Ip),
sdlan_hostname_regedit:insert(FullHostname, Ip);
false ->
ok
end,
%% channel之间的关系
MRef = monitor(process, ChannelPid),