fix acl_changed event

This commit is contained in:
anlicheng 2026-05-26 14:18:21 +08:00
parent 5138a18364
commit 9ede6aaa40
3 changed files with 10 additions and 10 deletions

View File

@ -67,7 +67,7 @@
{mysql_sdlan,
[{size, 10}, {max_overflow, 20}, {worker_module, mysql}],
[
{host, {118, 178, 229, 213}},
{host, {47, 111, 101, 3}},
{port, 3306},
{user, "punchnetuser"},
{connect_mode, lazy},
@ -79,8 +79,8 @@
}
]},
{api_url, "http://127.0.0.1:18082/test/"}
%{api_url, "http://127.0.0.1:18082/test/"}
{api_url, "https://test.punchsky.com/api/"}
]},
{throttle, [

View File

@ -28,7 +28,7 @@ handle_request("POST", "/node/acl_changed", _, #{<<"network_id">> := NetworkId,
undefined ->
{ok, 200, sdlan_util:json_error(-1, <<"network not found">>)};
Pid ->
case sdlan_network:acl_changed(Pid, ClientId) of
case sdlan_network:exposed_service_changed(Pid, ClientId) of
ok ->
{ok, 200, sdlan_util:json_data(<<"success">>)};
{error, Reason} ->

View File

@ -20,7 +20,7 @@
%% API
-export([start_link/2]).
-export([get_name/1, get_pid/1, lookup_pid/1, peer_info/3, unregister/3, debug_info/1, get_network_id/1, attach/7, arp_request/2]).
-export([forward_by_ets/5, update_hole/7, disable_client/2, get_channel/2, acl_changed/2]).
-export([forward_by_ets/5, update_hole/7, disable_client/2, get_channel/2, exposed_service_changed/2]).
-export([command/4, wait_command_ack/2]).
%% gen_server callbacks
@ -155,9 +155,9 @@ update_hole(Pid, SessionToken, ClientId, Mac, Peer, NatType, V6Info) when is_pid
disable_client(Pid, ClientId) when is_pid(Pid), is_binary(ClientId) ->
gen_server:call(Pid, {disable_client, ClientId}).
-spec acl_changed(Pid :: pid(), ClientId :: binary()) -> ok | {error, Reason :: binary()}.
acl_changed(Pid, ClientId) when is_pid(Pid), is_binary(ClientId) ->
gen_server:call(Pid, {acl_changed, ClientId}).
-spec exposed_service_changed(Pid :: pid(), ClientId :: binary()) -> ok | {error, Reason :: binary()}.
exposed_service_changed(Pid, ClientId) when is_pid(Pid), is_binary(ClientId) ->
gen_server:call(Pid, {exposed_service_changed, ClientId}).
-spec get_channel(Pid :: pid(), ClientId :: binary()) -> error | {ok, ChannelPid :: pid()}.
get_channel(Pid, ClientId) when is_pid(Pid), is_binary(ClientId) ->
@ -323,7 +323,7 @@ handle_call({command, ReceiverPid, ClientId, SubCommand}, _From, State = #state{
end;
%% acl改变
handle_call({acl_changed, ClientId}, _From, State = #state{endpoint_table = EndpointTable}) ->
handle_call({exposed_service_changed, ClientId}, _From, State = #state{endpoint_table = EndpointTable}) ->
MatchSpec = ets:fun2ms(fun(Object = {_Mac, #endpoint{client_id = ClientId0}}) when ClientId0 =:= ClientId ->
Object
end),