mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-20 22:55:03 +00:00
IPv4: Implement bind() for TCP and UDP sockets.
We can't accept connections just yet, but this patch makes it possible to bind() to a given source address/port.
This commit is contained in:
@@ -104,3 +104,12 @@ int UDPSocket::protocol_allocate_source_port()
|
||||
}
|
||||
return -EADDRINUSE;
|
||||
}
|
||||
|
||||
KResult UDPSocket::protocol_bind()
|
||||
{
|
||||
LOCKER(sockets_by_port().lock());
|
||||
if (sockets_by_port().resource().contains(source_port()))
|
||||
return KResult(-EADDRINUSE);
|
||||
sockets_by_port().resource().set(source_port(), this);
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user