mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
Kernel: Tidy up TCPSocket creation a bit
- Rename create() => try_create() - Use adopt_nonnull_ref_or_enomem()
This commit is contained in:
parent
ac85fdeb1c
commit
648c768d81
3 changed files with 10 additions and 13 deletions
|
@ -47,10 +47,10 @@ KResultOr<NonnullRefPtr<Socket>> IPv4Socket::create(int type, int protocol)
|
|||
return ENOMEM;
|
||||
|
||||
if (type == SOCK_STREAM) {
|
||||
auto tcp_socket = TCPSocket::create(protocol, receive_buffer.release_nonnull());
|
||||
if (tcp_socket.is_error())
|
||||
return tcp_socket.error();
|
||||
return tcp_socket.release_value();
|
||||
auto tcp_socket_or_error = TCPSocket::try_create(protocol, receive_buffer.release_nonnull());
|
||||
if (tcp_socket_or_error.is_error())
|
||||
return tcp_socket_or_error.error();
|
||||
return tcp_socket_or_error.release_value();
|
||||
}
|
||||
if (type == SOCK_DGRAM) {
|
||||
auto udp_socket = UDPSocket::create(protocol, receive_buffer.release_nonnull());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue