fix
This commit is contained in:
parent
7a5cb71bd4
commit
83e226aaf6
@ -84,13 +84,13 @@ handle_info({udp, Sock, Ip, Port, Body}, State = #state{socket = Sock}) ->
|
|||||||
#'SDLV6AssistProbe'{assist_token = Token} ->
|
#'SDLV6AssistProbe'{assist_token = Token} ->
|
||||||
case sdlan_token_store:lookup(Token) of
|
case sdlan_token_store:lookup(Token) of
|
||||||
true ->
|
true ->
|
||||||
Reply = sdlan_pb:encode_msg(#'SDLV6AssistProbeReply'{
|
case ipv6_assist_probe_reply(Ip, Port) of
|
||||||
v6_info = #'SDLV6Info' {
|
Reply = #'SDLV6AssistProbeReply'{} ->
|
||||||
v6 = Ip,
|
ReplyBin = sdlan_pb:encode_msg(Reply),
|
||||||
port = Port
|
ok = gen_udp:send(Sock, Ip, Port, ReplyBin);
|
||||||
}
|
undefined ->
|
||||||
}),
|
ok
|
||||||
ok = gen_udp:send(Sock, Ip, Port, Reply);
|
end;
|
||||||
false ->
|
false ->
|
||||||
ok
|
ok
|
||||||
end;
|
end;
|
||||||
@ -111,3 +111,20 @@ terminate(_Reason, _State = #state{}) ->
|
|||||||
{ok, NewState :: #state{}} | {error, Reason :: term()}.
|
{ok, NewState :: #state{}} | {error, Reason :: term()}.
|
||||||
code_change(_OldVsn, State = #state{}, _Extra) ->
|
code_change(_OldVsn, State = #state{}, _Extra) ->
|
||||||
{ok, State}.
|
{ok, State}.
|
||||||
|
|
||||||
|
-spec ipv6_assist_probe_reply(Ip :: inet:ip_address(), Port :: integer()) ->
|
||||||
|
undefined | #'SDLV6AssistProbeReply'{}.
|
||||||
|
ipv6_assist_probe_reply(Ip, Port) when is_integer(Port), Port > 0, Port =< 65535 ->
|
||||||
|
case sdlan_util:ipv6_to_bytes(Ip) of
|
||||||
|
<<_:128>> = V6Bytes ->
|
||||||
|
#'SDLV6AssistProbeReply'{
|
||||||
|
v6_info = #'SDLV6Info'{
|
||||||
|
v6 = V6Bytes,
|
||||||
|
port = Port
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_ ->
|
||||||
|
undefined
|
||||||
|
end;
|
||||||
|
ipv6_assist_probe_reply(_, _) ->
|
||||||
|
undefined.
|
||||||
Loading…
x
Reference in New Issue
Block a user