mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +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:
parent
9f633a1871
commit
03da7046bd
Notes:
sideshowbarker
2024-07-19 14:18:17 +09:00
Author: https://github.com/awesomekling
Commit: 03da7046bd
14 changed files with 118 additions and 115 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue