1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:08:13 +00:00

Kernel: Make TCPSocket::for_each() callback accept a reference

Yay for less arrows!
This commit is contained in:
Sergey Bugaev 2019-08-09 13:26:29 +03:00 committed by Andreas Kling
parent 84a54c7cf7
commit d06f4291a8
3 changed files with 14 additions and 14 deletions

View file

@ -8,11 +8,11 @@
//#define TCP_SOCKET_DEBUG
void TCPSocket::for_each(Function<void(TCPSocket*&)> callback)
void TCPSocket::for_each(Function<void(TCPSocket&)> callback)
{
LOCKER(sockets_by_tuple().lock());
for (auto& it : sockets_by_tuple().resource())
callback(it.value);
callback(*it.value);
}
Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()

View file

@ -6,7 +6,7 @@
class TCPSocket final : public IPv4Socket {
public:
static void for_each(Function<void(TCPSocket*&)>);
static void for_each(Function<void(TCPSocket&)>);
static NonnullRefPtr<TCPSocket> create(int protocol);
virtual ~TCPSocket() override;