summaryrefslogtreecommitdiff
path: root/Kernel/Net/Socket.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-10 11:55:37 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-10 21:58:58 +0100
commit88b6428c25ea046a4bb19bb6f3f68dd4f1439539 (patch)
tree86eca67f4ffc83d5387590b0d502ecce7cc07b91 /Kernel/Net/Socket.cpp
parentcd49f30bea734feb9ac46d637e2ed3439e47e3c3 (diff)
downloadserenity-88b6428c25ea046a4bb19bb6f3f68dd4f1439539.zip
AK: Make Vector::try_* functions return ErrorOr<void>
Instead of signalling allocation failure with a bool return value (false), we now use ErrorOr<void> and return ENOMEM as appropriate. This allows us to use TRY() and MUST() with Vector. :^)
Diffstat (limited to 'Kernel/Net/Socket.cpp')
-rw-r--r--Kernel/Net/Socket.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp
index 151eba6e90..69c4c0dfd9 100644
--- a/Kernel/Net/Socket.cpp
+++ b/Kernel/Net/Socket.cpp
@@ -71,8 +71,7 @@ ErrorOr<void> Socket::queue_connection_from(NonnullRefPtr<Socket> peer)
MutexLocker locker(mutex());
if (m_pending.size() >= m_backlog)
return set_so_error(ECONNREFUSED);
- if (!m_pending.try_append(peer))
- return set_so_error(ENOMEM);
+ SOCKET_TRY(m_pending.try_append(peer));
evaluate_block_conditions();
return {};
}