mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:57:34 +00:00
Everywhere: Hook up remaining debug macros to Debug.h.
This commit is contained in:
parent
da69de1f1b
commit
eea72b9b5c
63 changed files with 458 additions and 287 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "DNSResponse.h"
|
||||
#include "DNSPacket.h"
|
||||
#include "DNSRequest.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
|
||||
|
@ -61,7 +62,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t
|
|||
}
|
||||
|
||||
auto& response_header = *(const DNSPacket*)(raw_data);
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Got response (ID: {})", response_header.id());
|
||||
dbgln(" Question count: {}", response_header.question_count());
|
||||
dbgln(" Answer count: {}", response_header.answer_count());
|
||||
|
@ -87,7 +88,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t
|
|||
auto& record_and_class = *(const RawDNSAnswerQuestion*)&raw_data[offset];
|
||||
response.m_questions.empend(name, record_and_class.record_type, record_and_class.class_code);
|
||||
offset += 4;
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
auto& question = response.m_questions.last();
|
||||
dbgln("Question #{}: name=_{}_, type={}, class={}", i, question.name(), question.record_type(), question.class_code());
|
||||
#endif
|
||||
|
@ -111,7 +112,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t
|
|||
// FIXME: Parse some other record types perhaps?
|
||||
dbgln("data=(unimplemented record type {})", record.type());
|
||||
}
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Answer #{}: name=_{}_, type={}, ttl={}, length={}, data=_{}_", i, name, record.type(), record.ttl(), record.data_length(), data);
|
||||
#endif
|
||||
response.m_answers.empend(name, record.type(), record.record_class(), record.ttl(), data);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "DNSRequest.h"
|
||||
#include "DNSResponse.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
|
@ -113,7 +114,7 @@ void LookupServer::service_client(RefPtr<Core::LocalSocket> socket)
|
|||
return;
|
||||
}
|
||||
auto hostname = String((const char*)client_buffer + 1, nrecv - 1, Chomp);
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Got request for '{}'", hostname);
|
||||
#endif
|
||||
|
||||
|
@ -123,7 +124,7 @@ void LookupServer::service_client(RefPtr<Core::LocalSocket> socket)
|
|||
responses.append(known_host.value());
|
||||
} else if (!hostname.is_empty()) {
|
||||
for (auto& nameserver : m_nameservers) {
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Doing lookup using nameserver '{}'", nameserver);
|
||||
#endif
|
||||
bool did_get_response = false;
|
||||
|
@ -174,7 +175,7 @@ Vector<String> LookupServer::lookup(const String& hostname, const String& namese
|
|||
if (cached_lookup.question.record_type() == record_type) {
|
||||
Vector<String> responses;
|
||||
for (auto& cached_answer : cached_lookup.answers) {
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Cache hit: {} -> {}, expired: {}", hostname, cached_answer.record_data(), cached_answer.has_expired());
|
||||
#endif
|
||||
if (!cached_answer.has_expired())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue