Example usage for io.netty.handler.codec.dns DnsSection AUTHORITY

List of usage examples for io.netty.handler.codec.dns DnsSection AUTHORITY

Introduction

In this page you can find the example usage for io.netty.handler.codec.dns DnsSection AUTHORITY.

Prototype

DnsSection AUTHORITY

To view the source code for io.netty.handler.codec.dns DnsSection AUTHORITY.

Click Source Link

Document

The section that contains the authority DnsRecord s.

Usage

From source file:io.vertx.core.dns.impl.fix.DnsNameResolverContext.java

License:Apache License

void onResponse(final DnsQuestion question, AddressedEnvelope<DnsResponse, InetSocketAddress> envelope) {
    try {//w w  w.j  a v  a2  s  .  c  o  m
        final DnsResponse res = envelope.content();
        final DnsResponseCode code = res.code();
        if (code == DnsResponseCode.NOERROR) {
            final DnsRecordType type = question.type();
            if (type == DnsRecordType.A || type == DnsRecordType.AAAA) {
                onResponseAorAAAA(type, question, envelope);
            } else if (type == DnsRecordType.CNAME) {
                onResponseCNAME(question, envelope);
            }
            return;
        }

        if (traceEnabled) {
            addTrace(envelope.sender(), "response code: " + code + " with " + res.count(DnsSection.ANSWER)
                    + " answer(s) and " + res.count(DnsSection.AUTHORITY) + " authority resource(s)");
        }

        // Retry with the next server if the server did not tell us that the domain does not exist.
        if (code != DnsResponseCode.NXDOMAIN) {
            query(nameServerAddrs.next(), question);
        }
    } finally {
        ReferenceCountUtil.safeRelease(envelope);
    }
}