diff options
author | Conrad Pankoff <deoxxa@fknsrs.biz> | 2019-09-08 17:16:40 +1000 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-08 12:34:20 +0200 |
commit | d53c9d4416de3471030bc9aa4255d020aaf40a5f (patch) | |
tree | 10215cd1b72b21cef00aabc31db99f5a80d8031e | |
parent | cfcb53fe777d3981588d9fd9eb8f816431e102af (diff) | |
download | serenity-d53c9d4416de3471030bc9aa4255d020aaf40a5f.zip |
Kernel: Use RefPtr instead of SocketHandle for TCPSocket clients
Using a SocketHandle takes a lock on the socket, which we don't want
to do.
-rw-r--r-- | Kernel/Net/TCPSocket.cpp | 6 | ||||
-rw-r--r-- | Kernel/Net/TCPSocket.h | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp index acdb6c341e..18ee8225fa 100644 --- a/Kernel/Net/TCPSocket.cpp +++ b/Kernel/Net/TCPSocket.cpp @@ -37,7 +37,7 @@ Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple() return *s_map; } -SocketHandle<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple) +RefPtr<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple) { LOCKER(sockets_by_tuple().lock()); @@ -58,12 +58,12 @@ SocketHandle<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple) return {}; } -SocketHandle<TCPSocket> TCPSocket::from_endpoints(const IPv4Address& local_address, u16 local_port, const IPv4Address& peer_address, u16 peer_port) +RefPtr<TCPSocket> TCPSocket::from_endpoints(const IPv4Address& local_address, u16 local_port, const IPv4Address& peer_address, u16 peer_port) { return from_tuple(IPv4SocketTuple(local_address, local_port, peer_address, peer_port)); } -SocketHandle<TCPSocket> TCPSocket::create_client(const IPv4Address& new_local_address, u16 new_local_port, const IPv4Address& new_peer_address, u16 new_peer_port) +RefPtr<TCPSocket> TCPSocket::create_client(const IPv4Address& new_local_address, u16 new_local_port, const IPv4Address& new_peer_address, u16 new_peer_port) { auto tuple = IPv4SocketTuple(new_local_address, new_local_port, new_peer_address, new_peer_port); diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h index 349b16d71f..f13591c3a2 100644 --- a/Kernel/Net/TCPSocket.h +++ b/Kernel/Net/TCPSocket.h @@ -122,10 +122,10 @@ public: void record_incoming_data(int); static Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& sockets_by_tuple(); - static SocketHandle<TCPSocket> from_tuple(const IPv4SocketTuple& tuple); - static SocketHandle<TCPSocket> from_endpoints(const IPv4Address& local_address, u16 local_port, const IPv4Address& peer_address, u16 peer_port); + static RefPtr<TCPSocket> from_tuple(const IPv4SocketTuple& tuple); + static RefPtr<TCPSocket> from_endpoints(const IPv4Address& local_address, u16 local_port, const IPv4Address& peer_address, u16 peer_port); - SocketHandle<TCPSocket> create_client(const IPv4Address& local_address, u16 local_port, const IPv4Address& peer_address, u16 peer_port); + RefPtr<TCPSocket> create_client(const IPv4Address& local_address, u16 local_port, const IPv4Address& peer_address, u16 peer_port); protected: void set_direction(Direction direction) { m_direction = direction; } |