Example usage for io.netty.handler.codec.dns DnsResponseCode NXDOMAIN

List of usage examples for io.netty.handler.codec.dns DnsResponseCode NXDOMAIN

Introduction

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

Prototype

DnsResponseCode NXDOMAIN

To view the source code for io.netty.handler.codec.dns DnsResponseCode NXDOMAIN.

Click Source Link

Document

The 'NXDomain' DNS RCODE (3), as defined in <a href="https://tools.ietf.org/html/rfc1035">RFC1035</a>.

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 {//from w  w w .  ja v a 2  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);
    }
}