mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 17:15:26 +00:00
Kernel: Prepare Socket for becoming a File.
Make the Socket functions take a FileDescriptor& rather than a socket role throughout the code. Also change threads to block on a FileDescriptor, rather than either an fd index or a Socket.
This commit is contained in:
@@ -152,7 +152,7 @@ NetworkOrdered<word> TCPSocket::compute_tcp_checksum(const IPv4Address& source,
|
||||
return ~(checksum & 0xffff);
|
||||
}
|
||||
|
||||
KResult TCPSocket::protocol_connect(ShouldBlock should_block)
|
||||
KResult TCPSocket::protocol_connect(FileDescriptor& descriptor, ShouldBlock should_block)
|
||||
{
|
||||
auto* adapter = adapter_for_route_to(destination_address());
|
||||
if (!adapter)
|
||||
@@ -167,8 +167,7 @@ KResult TCPSocket::protocol_connect(ShouldBlock should_block)
|
||||
m_state = State::Connecting;
|
||||
|
||||
if (should_block == ShouldBlock::Yes) {
|
||||
current->set_blocked_socket(this);
|
||||
current->block(Thread::BlockedConnect);
|
||||
current->block(Thread::BlockedConnect, descriptor);
|
||||
ASSERT(is_connected());
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user