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
commit 720a686a76
Notes: sideshowbarker 2024-07-18 07:31:29 +09:00
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;
};