fix
This commit is contained in:
parent
60516e83e0
commit
ba430e76ad
@ -21,7 +21,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/6]).
|
||||
-export([forward/5, update_hole/6, disable_client/2, get_channel/2]).
|
||||
-export([forward/5, update_hole/7, disable_client/2, get_channel/2]).
|
||||
-export([test_event/1]).
|
||||
|
||||
%% gen_server callbacks
|
||||
@ -114,9 +114,9 @@ forward(Pid, Sock, SrcMac, DstMac, Packet) when is_pid(Pid), is_binary(SrcMac),
|
||||
gen_server:cast(Pid, {forward, Sock, SrcMac, DstMac, Packet}).
|
||||
|
||||
%% 更新ip地址对应的nat关系
|
||||
-spec update_hole(Pid :: pid(), ClientId :: binary(), Mac :: binary(), Peer :: tuple(), NatType :: integer(), V6Info :: undefined | #sdl_v6_info{}) -> no_return().
|
||||
update_hole(Pid, ClientId, Mac, Peer, NatType, V6Info) when is_pid(Pid), is_binary(ClientId), is_binary(Mac), is_integer(NatType) ->
|
||||
gen_server:cast(Pid, {update_hole, ClientId, Mac, Peer, NatType, V6Info}).
|
||||
-spec update_hole(Pid :: pid(), SessionToken :: binary(), ClientId :: binary(), Mac :: binary(), Peer :: tuple(), NatType :: integer(), V6Info :: undefined | #sdl_v6_info{}) -> no_return().
|
||||
update_hole(Pid, SessionToken, ClientId, Mac, Peer, NatType, V6Info) when is_pid(Pid), is_binary(ClientId), is_binary(Mac), is_integer(NatType) ->
|
||||
gen_server:cast(Pid, {update_hole, SessionToken, ClientId, Mac, Peer, NatType, V6Info}).
|
||||
|
||||
-spec disable_client(Pid :: pid(), ClientId :: binary()) -> ok | error.
|
||||
disable_client(Pid, ClientId) when is_pid(Pid), is_binary(ClientId) ->
|
||||
|
||||
@ -100,9 +100,9 @@ handle_info({udp, Sock, Ip, Port, <<?PACKET_STUN_REQUEST:8, Body/binary>>}, Stat
|
||||
StunRequest = catch sdlan_pb:decode_msg(Body, sdl_stun_request),
|
||||
%% 告知网络当前的ip对应的nat的映射关系
|
||||
maybe
|
||||
#sdl_stun_request{cookie = Cookie, client_id = ClientId, network_id = NetworkId, mac = Mac, nat_type = NatType, v6_info = V6Info} ?= StunRequest,
|
||||
#sdl_stun_request{cookie = Cookie, session_token = SessionToken, client_id = ClientId, network_id = NetworkId, mac = Mac, nat_type = NatType, v6_info = V6Info} ?= StunRequest,
|
||||
{ok, NetworkPid} ?= sdlan_network:lookup_pid(NetworkId),
|
||||
sdlan_network:update_hole(NetworkPid, ClientId, Mac, {Ip, Port}, NatType, V6Info),
|
||||
sdlan_network:update_hole(NetworkPid, SessionToken, ClientId, Mac, {Ip, Port}, NatType, V6Info),
|
||||
StunReply = sdlan_pb:encode_msg(#sdl_stun_reply{
|
||||
cookie = Cookie
|
||||
}),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user