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
commit 9965e59ad8
Notes: sideshowbarker 2024-07-17 22:11:39 +09:00
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;
});
}