fix
This commit is contained in:
parent
8ab62fce53
commit
28355c1df0
@ -87,9 +87,10 @@ handle_cast(handle, State = #state{socket = Sock, src_ip = SrcIp, src_port = Src
|
||||
lager:debug("[dns_handler] qname: ~p", [Qname]),
|
||||
case dns_cache:lookup(Qname) of
|
||||
{hit, R} ->
|
||||
lager:debug("[dns_handler] hit cache rr: ~p", [R]),
|
||||
Resp = build_response(Msg, R),
|
||||
gen_udp:send(Sock, SrcIp, SrcPort, dns:encode_message(Resp)),
|
||||
{stop, normal};
|
||||
{stop, normal, State};
|
||||
miss ->
|
||||
lager:debug("[dns_handler] cache is miss"),
|
||||
forward_to_upstream(DnsIp, DnsPort, Packet, Msg),
|
||||
@ -99,7 +100,7 @@ handle_cast(handle, State = #state{socket = Sock, src_ip = SrcIp, src_port = Src
|
||||
end;
|
||||
Other ->
|
||||
lager:warning("[] decode msg get error: ~p", [Other]),
|
||||
{stop, normal}
|
||||
{stop, normal, State}
|
||||
end.
|
||||
|
||||
%% @private
|
||||
@ -125,7 +126,7 @@ handle_info({dns_resolver_reply, Resp}, State = #state{socket = Sock, src_ip = S
|
||||
%% 尝试解析
|
||||
case dns:decode_message(Resp) of
|
||||
Msg = #dns_message{answers = Answers} ->
|
||||
lager:debug("[dns_handler] get a resolver reply: ~p, bin: ~p", [Msg, dns:encode_message(Msg)]),
|
||||
lager:debug("[dns_handler] get a resolver reply: ~p, bin: ~p", [Msg, Answers]),
|
||||
dns_cache:insert(Qname, Answers),
|
||||
gen_udp:send(Sock, SrcIp, SrcPort, Resp);
|
||||
Other ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user