fix regedit
This commit is contained in:
parent
6d2f9d52c3
commit
11e559b76b
@ -27,6 +27,6 @@ lookup(FullHostname) when is_binary(FullHostname) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
-spec insert(FullHostname :: binary(), Ip :: integer()) -> no_return().
|
-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>>,
|
<<Ip0, Ip1, Ip2, Ip3>> = <<Ip:32>>,
|
||||||
true = ets:insert(?TABLE, {FullHostname, {Ip0, Ip1, Ip2, Ip3}}).
|
true = ets:insert(?TABLE, {FullHostname, {Ip0, Ip1, Ip2, Ip3}}).
|
||||||
@ -232,8 +232,13 @@ handle_call({assign_ip_addr, ChannelPid, ClientId, Mac, NetAddr0, HostName}, _Fr
|
|||||||
maybe_close_channel(maps:get(Mac, UsedMap, undefined)),
|
maybe_close_channel(maps:get(Mac, UsedMap, undefined)),
|
||||||
|
|
||||||
%% 添加域名->ip的映射关系
|
%% 添加域名->ip的映射关系
|
||||||
FullHostname = <<HostName/binary, ".", Domain/binary>>,
|
case HostName =/= <<>> of
|
||||||
sdlan_hostname_regedit:insert(FullHostname, Ip),
|
true ->
|
||||||
|
FullHostname = <<HostName/binary, ".", Domain/binary>>,
|
||||||
|
sdlan_hostname_regedit:insert(FullHostname, Ip);
|
||||||
|
false ->
|
||||||
|
ok
|
||||||
|
end,
|
||||||
|
|
||||||
%% 建立到新的channel之间的关系
|
%% 建立到新的channel之间的关系
|
||||||
MRef = monitor(process, ChannelPid),
|
MRef = monitor(process, ChannelPid),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user