summaryrefslogtreecommitdiff
path: root/Kernel/Net/Socket.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-12-25 11:23:57 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-25 11:23:57 +0100
commit9965e59ad8313cdbd758c06099c5e83cf241b15a (patch)
tree6f1349137accd86d8699e7a64ddaecaba6431ff2 /Kernel/Net/Socket.h
parente923cf6624b4195479e7881d57d933a0d5275c70 (diff)
downloadserenity-9965e59ad8313cdbd758c06099c5e83cf241b15a.zip
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.
Diffstat (limited to 'Kernel/Net/Socket.h')
-rw-r--r--Kernel/Net/Socket.h38
1 files changed, 0 insertions, 38 deletions
diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h
index 3c1d6c261c..72a159c843 100644
--- a/Kernel/Net/Socket.h
+++ b/Kernel/Net/Socket.h
@@ -183,44 +183,6 @@ private:
NonnullRefPtrVector<Socket> m_pending;
};
-template<typename SocketType>
-class SocketHandle {
-public:
- SocketHandle() = default;
-
- SocketHandle(NonnullRefPtr<SocketType>&& socket)
- : m_socket(move(socket))
- {
- if (m_socket)
- m_socket->mutex().lock();
- }
-
- SocketHandle(SocketHandle&& other)
- : m_socket(move(other.m_socket))
- {
- }
-
- ~SocketHandle()
- {
- if (m_socket)
- m_socket->mutex().unlock();
- }
-
- SocketHandle(const SocketHandle&) = delete;
- SocketHandle& operator=(const SocketHandle&) = delete;
-
- operator bool() const { return m_socket; }
-
- SocketType* operator->() { return &socket(); }
- const SocketType* operator->() const { return &socket(); }
-
- SocketType& socket() { return *m_socket; }
- const SocketType& socket() const { return *m_socket; }
-
-private:
- RefPtr<SocketType> m_socket;
-};
-
// This is a special variant of TRY() that also updates the socket's SO_ERROR field on error.
#define SOCKET_TRY(expression) \
({ \