adds debugging to dnsserver (#1046)

This commit is contained in:
Shawn A 2020-10-02 18:59:55 -05:00 committed by GitHub
parent fb6d5ad234
commit f76ec4f50b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,12 @@
#include <lwip/def.h> #include <lwip/def.h>
#include <Arduino.h> #include <Arduino.h>
// #define DEBUG_ESP_DNS
#ifdef DEBUG_ESP_PORT
#define DEBUG_OUTPUT DEBUG_ESP_PORT
#else
#define DEBUG_OUTPUT Serial
#endif
DNSServer::DNSServer() DNSServer::DNSServer()
{ {
@ -184,6 +190,11 @@ void DNSServer::replyWithIP()
_udp.write((unsigned char*) &answerIPv4, 2 ); _udp.write((unsigned char*) &answerIPv4, 2 );
_udp.write(_resolvedIP, sizeof(_resolvedIP)); // The IP address to return _udp.write(_resolvedIP, sizeof(_resolvedIP)); // The IP address to return
_udp.endPacket(); _udp.endPacket();
#ifdef DEBUG_ESP_DNS
DEBUG_OUTPUT.printf("DNS responds: %s for %s\n",
IPAddress(_resolvedIP).toString().c_str(), getDomainNameWithoutWwwPrefix().c_str() );
#endif
} }
void DNSServer::replyWithCustomCode() void DNSServer::replyWithCustomCode()