1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

Kernel: Fix checking BlockResult

We now have BlockResult::WokeNormally and BlockResult::NotBlocked,
both of which indicate no error. We can no longer just check for
BlockResult::WokeNormally and assume anything else must be an
interruption.
This commit is contained in:
Tom 2020-07-06 17:10:52 -06:00 committed by Andreas Kling
parent 1493dd9dc6
commit 419703a1f2
7 changed files with 56 additions and 27 deletions

View file

@ -176,7 +176,7 @@ KResult LocalSocket::connect(FileDescription& description, const sockaddr* addre
return KSuccess;
}
if (Thread::current()->block<Thread::ConnectBlocker>(description) != Thread::BlockResult::WokeNormally) {
if (Thread::current()->block<Thread::ConnectBlocker>(description).was_interrupted()) {
m_connect_side_role = Role::None;
return KResult(-EINTR);
}
@ -300,8 +300,7 @@ ssize_t LocalSocket::recvfrom(FileDescription& description, void* buffer, size_t
return -EAGAIN;
}
} else if (!can_read(description, 0)) {
auto result = Thread::current()->block<Thread::ReadBlocker>(description);
if (result != Thread::BlockResult::WokeNormally)
if (Thread::current()->block<Thread::ReadBlocker>(description).was_interrupted())
return -EINTR;
}
if (!has_attached_peer(description) && buffer_for_me.is_empty())