summaryrefslogtreecommitdiff
path: root/Kernel/Net/LocalSocket.cpp
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-08-03 09:43:19 -0600
committerAndreas Kling <kling@serenityos.org>2020-08-03 18:23:00 +0200
commitf4a5c9b6c2eb6c52fb02b8362f05e33e3e18b1d7 (patch)
treeb57902a850ffc73b4d702217c69463c44de05ec4 /Kernel/Net/LocalSocket.cpp
parentdf52061cdbe880d96a01e8a1227917feaad1b87c (diff)
downloadserenity-f4a5c9b6c2eb6c52fb02b8362f05e33e3e18b1d7.zip
Kernel: Consolidate timeout logic
Allow passing in an optional timeout to Thread::block and move the timeout check out of Thread::Blocker. This way all Blockers implicitly support timeouts and don't need to implement it themselves. Do however allow them to override timeouts (e.g. for sockets).
Diffstat (limited to 'Kernel/Net/LocalSocket.cpp')
-rw-r--r--Kernel/Net/LocalSocket.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp
index 63008e2ab0..1dd6a00b5b 100644
--- a/Kernel/Net/LocalSocket.cpp
+++ b/Kernel/Net/LocalSocket.cpp
@@ -176,7 +176,7 @@ KResult LocalSocket::connect(FileDescription& description, const sockaddr* addre
return KSuccess;
}
- if (Thread::current()->block<Thread::ConnectBlocker>(description).was_interrupted()) {
+ if (Thread::current()->block<Thread::ConnectBlocker>(nullptr, description).was_interrupted()) {
m_connect_side_role = Role::None;
return KResult(-EINTR);
}
@@ -300,7 +300,7 @@ ssize_t LocalSocket::recvfrom(FileDescription& description, void* buffer, size_t
return -EAGAIN;
}
} else if (!can_read(description, 0)) {
- if (Thread::current()->block<Thread::ReadBlocker>(description).was_interrupted())
+ if (Thread::current()->block<Thread::ReadBlocker>(nullptr, description).was_interrupted())
return -EINTR;
}
if (!has_attached_peer(description) && buffer_for_me.is_empty())