mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
Kernel: Make TCPSocket::create API OOM safe
Note that the changes to IPv4Socket::create are unfortunately needed as the return type of TCPSocket::create and IPv4Socket::create don't match. - KResultOr<NonnullRefPtr<TcpSocket>>> vs - KResultOr<NonnullRefPtr<Socket>>> To handle this we are forced to manually decompose the KResultOr<T> and return the value() and error() separately.
This commit is contained in:
parent
9375f3dc09
commit
46ce7adf7b
3 changed files with 17 additions and 6 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <AK/HashMap.h>
|
||||
#include <AK/SinglyLinkedList.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/Net/IPv4Socket.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -17,7 +18,7 @@ namespace Kernel {
|
|||
class TCPSocket final : public IPv4Socket {
|
||||
public:
|
||||
static void for_each(Function<void(const TCPSocket&)>);
|
||||
static NonnullRefPtr<TCPSocket> create(int protocol);
|
||||
static KResultOr<NonnullRefPtr<TCPSocket>> create(int protocol);
|
||||
virtual ~TCPSocket() override;
|
||||
|
||||
enum class Direction {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue