mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
Kernel: Rename LocalSocket factory to try_create() & tighten return type
Also tighten the return type to KResultOr<NonnullRefPtr<LocalSocket>> since it cannot return any other socket type.
This commit is contained in:
parent
244ede561b
commit
242063866f
3 changed files with 10 additions and 6 deletions
|
@ -20,8 +20,12 @@ namespace Kernel {
|
|||
KResultOr<NonnullRefPtr<Socket>> Socket::create(int domain, int type, int protocol)
|
||||
{
|
||||
switch (domain) {
|
||||
case AF_LOCAL:
|
||||
return LocalSocket::create(type & SOCK_TYPE_MASK);
|
||||
case AF_LOCAL: {
|
||||
auto socket_or_error = LocalSocket::try_create(type & SOCK_TYPE_MASK);
|
||||
if (socket_or_error.is_error())
|
||||
return socket_or_error.error();
|
||||
return socket_or_error.release_value();
|
||||
}
|
||||
case AF_INET:
|
||||
return IPv4Socket::create(type & SOCK_TYPE_MASK, protocol);
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue