1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

Kernel: Handle OOM when allocating Packet KBuffers

This commit is contained in:
Brian Gianforcaro 2021-08-01 05:11:49 -07:00 committed by Andreas Kling
parent 8c4785bd10
commit 720a686a76
6 changed files with 47 additions and 38 deletions

View file

@ -28,13 +28,15 @@ class NetworkAdapter;
using NetworkByteBuffer = AK::Detail::ByteBuffer<1500>;
struct PacketWithTimestamp : public RefCounted<PacketWithTimestamp> {
PacketWithTimestamp(KBuffer buffer, Time timestamp)
PacketWithTimestamp(NonnullOwnPtr<KBuffer> buffer, Time timestamp)
: buffer(move(buffer))
, timestamp(timestamp)
{
}
KBuffer buffer;
ReadonlyBytes bytes() { return { buffer->data(), buffer->size() }; };
NonnullOwnPtr<KBuffer> buffer;
Time timestamp;
IntrusiveListNode<PacketWithTimestamp, RefPtr<PacketWithTimestamp>> packet_node;
};