1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

Kernel: Remove unnecessary SocketHandle<T> class

This was used to return a pre-locked UDPSocket in one place, but there
was really no need for that mechanism in the first place since the
caller ends up locking the socket anyway.
This commit is contained in:
Andreas Kling 2021-12-25 11:23:57 +01:00
parent e923cf6624
commit 9965e59ad8
3 changed files with 4 additions and 45 deletions

View file

@ -29,16 +29,13 @@ MutexProtected<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port()
return *s_map;
}
SocketHandle<UDPSocket> UDPSocket::from_port(u16 port)
RefPtr<UDPSocket> UDPSocket::from_port(u16 port)
{
return sockets_by_port().with_shared([&](const auto& table) -> SocketHandle<UDPSocket> {
RefPtr<UDPSocket> socket;
return sockets_by_port().with_shared([&](const auto& table) -> RefPtr<UDPSocket> {
auto it = table.find(port);
if (it == table.end())
return {};
socket = (*it).value;
VERIFY(socket);
return { *socket };
return (*it).value;
});
}