mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
This commit is contained in:
parent
7d783d8b84
commit
3f23a58fa1
Notes:
sideshowbarker
2024-07-18 22:58:25 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/3f23a58fa1a Pull-request: https://github.com/SerenityOS/serenity/pull/5012 Reviewed-by: https://github.com/alimpfard
9 changed files with 97 additions and 70 deletions
29
AK/Debug.h
29
AK/Debug.h
|
@ -442,3 +442,32 @@ constexpr bool debug_trace_tokenizer = true;
|
|||
constexpr bool debug_trace_tokenizer = false;
|
||||
#endif
|
||||
|
||||
#ifdef IMAGE_LOADER_DEBUG
|
||||
constexpr bool debug_image_loader = true;
|
||||
#else
|
||||
constexpr bool debug_image_loader = false;
|
||||
#endif
|
||||
|
||||
#ifdef RESOURCE_DEBUG
|
||||
constexpr bool debug_resource = true;
|
||||
#else
|
||||
constexpr bool debug_resource = false;
|
||||
#endif
|
||||
|
||||
#ifdef CACHE_DEBUG
|
||||
constexpr bool debug_cache = true;
|
||||
#else
|
||||
constexpr bool debug_cache = false;
|
||||
#endif
|
||||
|
||||
#ifdef DHCPV4_DEBUG
|
||||
constexpr bool debug_dhcpv4 = true;
|
||||
#else
|
||||
constexpr bool debug_dhcpv4 = false;
|
||||
#endif
|
||||
|
||||
#ifdef DHCPV4CLIENT_DEBUG
|
||||
constexpr bool debug_dhcpv4_client = true;
|
||||
#else
|
||||
constexpr bool debug_dhcpv4_client = false;
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibGemini/Document.h>
|
||||
#include <LibGfx/ImageDecoder.h>
|
||||
|
@ -39,8 +40,6 @@
|
|||
#include <LibWeb/Page/Frame.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
||||
//#define GEMINI_DEBUG 1
|
||||
|
||||
namespace Web {
|
||||
|
||||
FrameLoader::FrameLoader(Frame& frame)
|
||||
|
@ -180,14 +179,14 @@ bool FrameLoader::load(const LoadRequest& request, Type type)
|
|||
ResourceLoader::the().load(
|
||||
favicon_url,
|
||||
[this, favicon_url](auto data, auto&) {
|
||||
dbg() << "Favicon downloaded, " << data.size() << " bytes from " << favicon_url;
|
||||
dbgln("Favicon downloaded, {} bytes from {}", data.size(), favicon_url);
|
||||
auto decoder = Gfx::ImageDecoder::create(data.data(), data.size());
|
||||
auto bitmap = decoder->bitmap();
|
||||
if (!bitmap) {
|
||||
dbg() << "Could not decode favicon " << favicon_url;
|
||||
dbgln("Could not decode favicon {}", favicon_url);
|
||||
return;
|
||||
}
|
||||
dbg() << "Decoded favicon, " << bitmap->size();
|
||||
dbgln("Decoded favicon, {}", bitmap->size());
|
||||
if (auto* page = frame().page())
|
||||
page->client().page_did_change_favicon(*bitmap);
|
||||
});
|
||||
|
@ -198,7 +197,7 @@ bool FrameLoader::load(const LoadRequest& request, Type type)
|
|||
|
||||
bool FrameLoader::load(const URL& url, Type type)
|
||||
{
|
||||
dbg() << "FrameLoader::load: " << url;
|
||||
dbgln("FrameLoader::load: {}", url);
|
||||
|
||||
if (!url.is_valid()) {
|
||||
load_error_page(url, "Invalid URL");
|
||||
|
@ -240,7 +239,7 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error)
|
|||
frame().set_document(document);
|
||||
},
|
||||
[](auto error) {
|
||||
dbg() << "Failed to load error page: " << error;
|
||||
dbgln("Failed to load error page: {}", error);
|
||||
ASSERT_NOT_REACHED();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImageDecoder.h>
|
||||
|
@ -71,13 +72,13 @@ void ImageLoader::resource_did_load()
|
|||
|
||||
m_loading_state = LoadingState::Loaded;
|
||||
|
||||
#ifdef IMAGE_LOADER_DEBUG
|
||||
if (!resource()->has_encoded_data()) {
|
||||
dbg() << "ImageLoader: Resource did load, no encoded data. URL: " << resource()->url();
|
||||
} else {
|
||||
dbg() << "ImageLoader: Resource did load, has encoded data. URL: " << resource()->url();
|
||||
if constexpr (debug_image_loader) {
|
||||
if (!resource()->has_encoded_data()) {
|
||||
dbgln("ImageLoader: Resource did load, no encoded data. URL: {}", resource()->url());
|
||||
} else {
|
||||
dbgln("ImageLoader: Resource did load, has encoded data. URL: {}", resource()->url());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (resource()->should_decode_in_process()) {
|
||||
auto& decoder = resource()->ensure_decoder();
|
||||
|
@ -121,7 +122,7 @@ void ImageLoader::animate()
|
|||
|
||||
void ImageLoader::resource_did_fail()
|
||||
{
|
||||
dbg() << "ImageLoader: Resource did fail. URL: " << resource()->url();
|
||||
dbgln("ImageLoader: Resource did fail. URL: {}", resource()->url());
|
||||
m_loading_state = LoadingState::Failed;
|
||||
if (on_fail)
|
||||
on_fail();
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Function.h>
|
||||
#include <LibCore/MimeData.h>
|
||||
#include <LibWeb/HTML/HTMLImageElement.h>
|
||||
|
@ -99,9 +100,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap
|
|||
m_encoding = encoding_from_content_type(content_type.value());
|
||||
m_mime_type = mime_type_from_content_type(content_type.value());
|
||||
} else if (url().protocol() == "data" && !url().data_mime_type().is_empty()) {
|
||||
#ifdef RESOURCE_DEBUG
|
||||
dbg() << "This is a data URL with mime-type _" << url().data_mime_type() << "_";
|
||||
#endif
|
||||
dbgln<debug_resource>("This is a data URL with mime-type _{}_", url().data_mime_type());
|
||||
m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
|
||||
m_mime_type = url().data_mime_type();
|
||||
} else {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Base64.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
|
@ -35,8 +36,6 @@
|
|||
#include <LibWeb/Loader/Resource.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
|
||||
//#define CACHE_DEBUG
|
||||
|
||||
namespace Web {
|
||||
|
||||
ResourceLoader& ResourceLoader::the()
|
||||
|
@ -82,11 +81,9 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, const LoadRe
|
|||
auto it = s_resource_cache.find(request);
|
||||
if (it != s_resource_cache.end()) {
|
||||
if (it->value->type() != type) {
|
||||
dbg() << "FIXME: Not using cached resource for " << request.url() << " since there's a type mismatch.";
|
||||
dbgln("FIXME: Not using cached resource for {} since there's a type mismatch.", request.url());
|
||||
} else {
|
||||
#ifdef CACHE_DEBUG
|
||||
dbg() << "Reusing cached resource for: " << request.url();
|
||||
#endif
|
||||
dbgln<debug_cache>("Reusing cached resource for: {}", request.url());
|
||||
return it->value;
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +109,7 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
|
|||
auto& url = request.url();
|
||||
|
||||
if (is_port_blocked(url.port())) {
|
||||
dbg() << "ResourceLoader::load: Error: blocked port " << url.port() << " for URL: " << url;
|
||||
dbgln("ResourceLoader::load: Error: blocked port {} from URL {}", url.port(), url);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -123,7 +120,7 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
|
|||
}
|
||||
|
||||
if (url.protocol() == "about") {
|
||||
dbg() << "Loading about: URL " << url;
|
||||
dbgln("Loading about: URL {}", url);
|
||||
deferred_invoke([success_callback = move(success_callback)](auto&) {
|
||||
success_callback(String::empty().to_byte_buffer(), {});
|
||||
});
|
||||
|
@ -131,7 +128,10 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
|
|||
}
|
||||
|
||||
if (url.protocol() == "data") {
|
||||
dbg() << "ResourceLoader loading a data URL with mime-type: '" << url.data_mime_type() << "', base64=" << url.data_payload_is_base64() << ", payload='" << url.data_payload() << "'";
|
||||
dbgln("ResourceLoader loading a data URL with mime-type: '{}', base64={}, payload='{}'",
|
||||
url.data_mime_type(),
|
||||
url.data_payload_is_base64(),
|
||||
url.data_payload());
|
||||
|
||||
ByteBuffer data;
|
||||
if (url.data_payload_is_base64())
|
||||
|
@ -149,7 +149,7 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
|
|||
auto f = Core::File::construct();
|
||||
f->set_filename(url.path());
|
||||
if (!f->open(Core::IODevice::OpenMode::ReadOnly)) {
|
||||
dbg() << "ResourceLoader::load: Error: " << f->error_string();
|
||||
dbgln("ResourceLoader::load: Error: {}", f->error_string());
|
||||
if (error_callback)
|
||||
error_callback(f->error_string());
|
||||
return;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/Path.h>
|
||||
|
@ -33,8 +34,6 @@
|
|||
#include <LibWeb/SVG/SVGPathElement.h>
|
||||
#include <ctype.h>
|
||||
|
||||
//#define PATH_DEBUG
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
#ifdef PATH_DEBUG
|
||||
|
@ -136,7 +135,7 @@ void PathDataParser::parse_drawto()
|
|||
} else if (match('A') || match('a')) {
|
||||
parse_elliptical_arc();
|
||||
} else {
|
||||
dbg() << "PathDataParser::parse_drawto failed to match: '" << ch() << "'";
|
||||
dbgln("PathDataParser::parse_drawto failed to match: '{}'", ch());
|
||||
TODO();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "ChessEngine.h"
|
||||
#include "MCTSTree.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
|
||||
using namespace Chess::UCI;
|
||||
|
@ -68,9 +69,9 @@ void ChessEngine::handle_go(const GoCommand& command)
|
|||
mcts.do_round();
|
||||
++rounds;
|
||||
}
|
||||
dbg() << "MCTS finished " << rounds << " rounds.";
|
||||
dbg() << "MCTS evaluation " << mcts.expected_value();
|
||||
dbgln("MCTS finished {} rounds.", rounds);
|
||||
dbgln("MCTS evaluation {}", mcts.expected_value());
|
||||
auto best_move = mcts.best_move();
|
||||
dbg() << "MCTS best move " << best_move.to_long_algebraic();
|
||||
dbgln("MCTS best move {}", best_move.to_long_algebraic());
|
||||
send_command(BestMoveCommand(best_move));
|
||||
}
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "DHCPv4.h"
|
||||
|
||||
//#define DHCPV4_DEBUG
|
||||
#include <AK/Debug.h>
|
||||
|
||||
ParsedDHCPv4Options DHCPv4Packet::parse_options() const
|
||||
{
|
||||
|
@ -42,12 +41,10 @@ ParsedDHCPv4Options DHCPv4Packet::parse_options() const
|
|||
++index;
|
||||
auto length = m_options[index];
|
||||
if ((size_t)length > DHCPV4_OPTION_FIELD_MAX_LENGTH - index) {
|
||||
dbg() << "Bogus option length " << length << " assuming forgotten END";
|
||||
dbgln("Bogus option length {} assuming forgotten END", length);
|
||||
break;
|
||||
}
|
||||
#ifdef DHCPV4_DEBUG
|
||||
dbg() << "DHCP Option " << (u8)opt_name << " with length " << length;
|
||||
#endif
|
||||
dbgln<debug_dhcpv4>("DHCP Option {} with length {}", (u8)opt_name, length);
|
||||
++index;
|
||||
options.options.set(opt_name, { length, &m_options[index] });
|
||||
index += length - 1;
|
||||
|
|
|
@ -26,24 +26,23 @@
|
|||
|
||||
#include "DHCPv4Client.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Endian.h>
|
||||
#include <AK/Function.h>
|
||||
#include <LibCore/SocketAddress.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//#define DHCPV4CLIENT_DEBUG
|
||||
|
||||
static void send(const InterfaceDescriptor& iface, const DHCPv4Packet& packet, Core::Object*)
|
||||
{
|
||||
int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (fd < 0) {
|
||||
dbg() << "ERROR: socket :: " << strerror(errno);
|
||||
dbgln("ERROR: socket :: {}", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, iface.m_ifname.characters(), IFNAMSIZ) < 0) {
|
||||
dbg() << "ERROR: setsockopt(SO_BINDTODEVICE) :: " << strerror(errno);
|
||||
dbgln("ERROR: setsockopt(SO_BINDTODEVICE) :: {}", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -56,7 +55,7 @@ static void send(const InterfaceDescriptor& iface, const DHCPv4Packet& packet, C
|
|||
|
||||
auto rc = sendto(fd, &packet, sizeof(packet), 0, (sockaddr*)&dst, sizeof(dst));
|
||||
if (rc < 0) {
|
||||
dbg() << "sendto failed with " << strerror(errno);
|
||||
dbgln("sendto failed with {}", strerror(errno));
|
||||
// FIXME: what do we do here?
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +64,7 @@ static void set_params(const InterfaceDescriptor& iface, const IPv4Address& ipv4
|
|||
{
|
||||
int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
|
||||
if (fd < 0) {
|
||||
dbg() << "ERROR: socket :: " << strerror(errno);
|
||||
dbgln("ERROR: socket :: {}", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -83,14 +82,14 @@ static void set_params(const InterfaceDescriptor& iface, const IPv4Address& ipv4
|
|||
((sockaddr_in&)ifr.ifr_addr).sin_addr.s_addr = ipv4_addr.to_in_addr_t();
|
||||
|
||||
if (ioctl(fd, SIOCSIFADDR, &ifr) < 0) {
|
||||
dbg() << "ERROR: ioctl(SIOCSIFADDR) :: " << strerror(errno);
|
||||
dbgln("ERROR: ioctl(SIOCSIFADDR) :: {}", strerror(errno));
|
||||
}
|
||||
|
||||
// set the network mask
|
||||
((sockaddr_in&)ifr.ifr_netmask).sin_addr.s_addr = netmask.to_in_addr_t();
|
||||
|
||||
if (ioctl(fd, SIOCSIFNETMASK, &ifr) < 0) {
|
||||
dbg() << "ERROR: ioctl(SIOCSIFNETMASK) :: " << strerror(errno);
|
||||
dbgln("ERROR: ioctl(SIOCSIFNETMASK) :: {}", strerror(errno));
|
||||
}
|
||||
|
||||
// set the default gateway
|
||||
|
@ -103,7 +102,7 @@ static void set_params(const InterfaceDescriptor& iface, const IPv4Address& ipv4
|
|||
rt.rt_flags = RTF_UP | RTF_GATEWAY;
|
||||
|
||||
if (ioctl(fd, SIOCADDRT, &rt) < 0) {
|
||||
dbg() << "Error: ioctl(SIOCADDRT) :: " << strerror(errno);
|
||||
dbgln("Error: ioctl(SIOCADDRT) :: {}", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,9 +112,9 @@ DHCPv4Client::DHCPv4Client(Vector<InterfaceDescriptor> ifnames)
|
|||
m_server = Core::UDPServer::construct(this);
|
||||
m_server->on_ready_to_receive = [this] {
|
||||
auto buffer = m_server->receive(sizeof(DHCPv4Packet));
|
||||
dbg() << "Received " << buffer.size() << " bytes";
|
||||
dbgln("Received {} bytes", buffer.size());
|
||||
if (buffer.size() != sizeof(DHCPv4Packet)) {
|
||||
dbg() << "we expected " << sizeof(DHCPv4Packet) << " bytes, this is a bad packet";
|
||||
dbgln("we expected {} bytes, this is a bad packet", sizeof(DHCPv4Packet));
|
||||
return;
|
||||
}
|
||||
auto& packet = *(DHCPv4Packet*)buffer.data();
|
||||
|
@ -137,10 +136,10 @@ DHCPv4Client::~DHCPv4Client()
|
|||
|
||||
void DHCPv4Client::handle_offer(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options)
|
||||
{
|
||||
dbg() << "We were offered " << packet.yiaddr().to_string() << " for " << options.get<u32>(DHCPOption::IPAddressLeaseTime).value_or(0);
|
||||
dbgln("We were offered {} for {}", packet.yiaddr().to_string(), options.get<u32>(DHCPOption::IPAddressLeaseTime).value_or(0));
|
||||
auto* transaction = const_cast<DHCPv4Transaction*>(m_ongoing_transactions.get(packet.xid()).value_or(nullptr));
|
||||
if (!transaction) {
|
||||
dbg() << "we're not looking for " << packet.xid();
|
||||
dbgln("we're not looking for {}", packet.xid());
|
||||
return;
|
||||
}
|
||||
if (transaction->has_ip)
|
||||
|
@ -157,13 +156,14 @@ void DHCPv4Client::handle_offer(const DHCPv4Packet& packet, const ParsedDHCPv4Op
|
|||
|
||||
void DHCPv4Client::handle_ack(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options)
|
||||
{
|
||||
#ifdef DHCPV4CLIENT_DEBUG
|
||||
dbg() << "The DHCP server handed us " << packet.yiaddr().to_string();
|
||||
dbg() << "Here are the options: " << options.to_string();
|
||||
#endif
|
||||
if constexpr (debug_dhcpv4_client) {
|
||||
dbgln("The DHCP server handed us {}", packet.yiaddr().to_string());
|
||||
dbgln("Here are the options: {}", options.to_string());
|
||||
}
|
||||
|
||||
auto* transaction = const_cast<DHCPv4Transaction*>(m_ongoing_transactions.get(packet.xid()).value_or(nullptr));
|
||||
if (!transaction) {
|
||||
dbg() << "we're not looking for " << packet.xid();
|
||||
dbgln("we're not looking for {}", packet.xid());
|
||||
return;
|
||||
}
|
||||
transaction->has_ip = true;
|
||||
|
@ -184,12 +184,12 @@ void DHCPv4Client::handle_ack(const DHCPv4Packet& packet, const ParsedDHCPv4Opti
|
|||
|
||||
void DHCPv4Client::handle_nak(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options)
|
||||
{
|
||||
dbg() << "The DHCP server told us to go chase our own tail about " << packet.yiaddr().to_string();
|
||||
dbg() << "Here are the options: " << options.to_string();
|
||||
dbgln("The DHCP server told us to go chase our own tail about {}", packet.yiaddr().to_string());
|
||||
dbgln("Here are the options: {}", options.to_string());
|
||||
// make another request a bit later :shrug:
|
||||
auto* transaction = const_cast<DHCPv4Transaction*>(m_ongoing_transactions.get(packet.xid()).value_or(nullptr));
|
||||
if (!transaction) {
|
||||
dbg() << "we're not looking for " << packet.xid();
|
||||
dbgln("we're not looking for {}", packet.xid());
|
||||
return;
|
||||
}
|
||||
transaction->accepted_offer = false;
|
||||
|
@ -206,9 +206,9 @@ void DHCPv4Client::handle_nak(const DHCPv4Packet& packet, const ParsedDHCPv4Opti
|
|||
void DHCPv4Client::process_incoming(const DHCPv4Packet& packet)
|
||||
{
|
||||
auto options = packet.parse_options();
|
||||
#ifdef DHCPV4CLIENT_DEBUG
|
||||
dbg() << "Here are the options: " << options.to_string();
|
||||
#endif
|
||||
|
||||
dbgln<debug_dhcpv4_client>("Here are the options: {}", options.to_string());
|
||||
|
||||
auto value = options.get<DHCPMessageType>(DHCPOption::DHCPMessageType).value();
|
||||
switch (value) {
|
||||
case DHCPMessageType::DHCPOffer:
|
||||
|
@ -229,7 +229,7 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet)
|
|||
break;
|
||||
case DHCPMessageType::DHCPDecline:
|
||||
default:
|
||||
dbg() << "I dunno what to do with this " << (u8)value;
|
||||
dbgln("I dunno what to do with this {}", (u8)value);
|
||||
ASSERT_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
|
@ -238,11 +238,13 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet)
|
|||
void DHCPv4Client::dhcp_discover(const InterfaceDescriptor& iface, IPv4Address previous)
|
||||
{
|
||||
auto transaction_id = rand();
|
||||
#ifdef DHCPV4CLIENT_DEBUG
|
||||
dbg() << "Trying to lease an IP for " << iface.m_ifname << " with ID " << transaction_id;
|
||||
if (!previous.is_zero())
|
||||
dbg() << "going to request the server to hand us " << previous.to_string();
|
||||
#endif
|
||||
|
||||
if constexpr (debug_dhcpv4_client) {
|
||||
dbgln("Trying to lease an IP for {} with ID {}", iface.m_ifname, transaction_id);
|
||||
if (!previous.is_zero())
|
||||
dbgln("going to request the server to hand us {}", previous.to_string());
|
||||
}
|
||||
|
||||
DHCPv4PacketBuilder builder;
|
||||
|
||||
DHCPv4Packet& packet = builder.peek();
|
||||
|
@ -267,7 +269,7 @@ void DHCPv4Client::dhcp_discover(const InterfaceDescriptor& iface, IPv4Address p
|
|||
void DHCPv4Client::dhcp_request(DHCPv4Transaction& transaction, const DHCPv4Packet& offer)
|
||||
{
|
||||
auto& iface = transaction.interface;
|
||||
dbg() << "Leasing the IP " << offer.yiaddr().to_string() << " for adapter " << iface.m_ifname;
|
||||
dbgln("Leasing the IP {} for adapter {}", offer.yiaddr().to_string(), iface.m_ifname);
|
||||
DHCPv4PacketBuilder builder;
|
||||
|
||||
DHCPv4Packet& packet = builder.peek();
|
||||
|
|
Loading…
Add table
Reference in a new issue