Esempio n. 1
0
        public async Task <DnsResponse> ResolveName(IAdapter creator, AdapterRef handler, DnsRequest request)
        {
            var cxn = InConnectionDns.Create(creator, request);

            await HandleInConnection(cxn, handler);

            var result = cxn.ConnectResult;

            if (result?.Ok == false)
            {
                if (result.FailedReason != null)
                {
                    throw new Exception(result.FailedReason);
                }
                throw new Exception("name resolving failed.");
            }
            return(result as DnsResponse ?? DnsResponse.Empty(this));
        }
Esempio n. 2
0
 public static InConnectionDns Create(IAdapter creator, DnsRequest request) =>
 new InConnectionDns(creator)
 {
     Dest = new AddrPort(request.Name, 0), DnsRequest = request
 };