1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00

Kernel: Add TCPSocket::try_for_each() for fallible iteration

This API will allow users to short circuit iteration and properly
propagate errors.
This commit is contained in:
Idan Horowitz 2022-02-24 20:05:24 +02:00 committed by Andreas Kling
parent 24be52b3f5
commit aabc8d348b
2 changed files with 10 additions and 0 deletions

View file

@ -19,6 +19,7 @@ namespace Kernel {
class TCPSocket final : public IPv4Socket {
public:
static void for_each(Function<void(const TCPSocket&)>);
static ErrorOr<void> try_for_each(Function<ErrorOr<void>(const TCPSocket&)>);
static ErrorOr<NonnullRefPtr<TCPSocket>> try_create(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer);
virtual ~TCPSocket() override;