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

Kernel: Migrate UDP socket table locking to ProtectedValue

This commit is contained in:
Jean-Baptiste Boric 2021-07-18 12:24:34 +02:00 committed by Andreas Kling
parent 9216c72bfe
commit 9517100672
2 changed files with 37 additions and 36 deletions

View file

@ -7,7 +7,7 @@
#pragma once
#include <Kernel/KResult.h>
#include <Kernel/Locking/Lockable.h>
#include <Kernel/Locking/ProtectedValue.h>
#include <Kernel/Net/IPv4Socket.h>
namespace Kernel {
@ -23,7 +23,7 @@ public:
private:
explicit UDPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer);
virtual StringView class_name() const override { return "UDPSocket"; }
static Lockable<HashMap<u16, UDPSocket*>>& sockets_by_port();
static ProtectedValue<HashMap<u16, UDPSocket*>>& sockets_by_port();
virtual KResultOr<size_t> protocol_receive(ReadonlyBytes raw_ipv4_packet, UserOrKernelBuffer& buffer, size_t buffer_size, int flags) override;
virtual KResultOr<size_t> protocol_send(const UserOrKernelBuffer&, size_t) override;