mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +00:00
LibDNS: Prefer spans over raw pointers when parsing DNS packets
This means we don't have to keep track of the pointer and size separately.
This commit is contained in:
parent
c1d7a51391
commit
4e3b59a4bb
7 changed files with 23 additions and 25 deletions
|
@ -56,7 +56,7 @@ MulticastDNS::MulticastDNS(Core::EventReceiver* parent)
|
|||
ErrorOr<void> MulticastDNS::handle_packet()
|
||||
{
|
||||
auto buffer = TRY(receive(1024));
|
||||
auto optional_packet = Packet::from_raw_packet(buffer.data(), buffer.size());
|
||||
auto optional_packet = Packet::from_raw_packet(buffer);
|
||||
if (!optional_packet.has_value()) {
|
||||
dbgln("Got an invalid mDNS packet");
|
||||
return {};
|
||||
|
@ -175,7 +175,7 @@ ErrorOr<Vector<Answer>> MulticastDNS::lookup(Name const& name, RecordType record
|
|||
auto buffer = TRY(receive(1024));
|
||||
if (buffer.is_empty())
|
||||
return Vector<Answer> {};
|
||||
auto optional_packet = Packet::from_raw_packet(buffer.data(), buffer.size());
|
||||
auto optional_packet = Packet::from_raw_packet(buffer);
|
||||
if (!optional_packet.has_value()) {
|
||||
dbgln("Got an invalid mDNS packet");
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue