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:
Andreas Kling 2019-05-03 20:15:54 +02:00
parent 9f633a1871
commit 03da7046bd
Notes: sideshowbarker 2024-07-19 14:18:17 +09:00
14 changed files with 118 additions and 115 deletions

View file

@ -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;
}