mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
RequestServer: Use Core::System::pipe2 for creating the request FDs
This causes a behavior change in which the read FD is now non-blocking. This is intentional, as this change avoids a deadlock between RS and WebContent, where WC could block while reading from the request FD, while RS is blocked sending a message to WC.
This commit is contained in:
parent
a973fe13cb
commit
644e764620
Notes:
sideshowbarker
2024-07-17 07:08:37 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/644e764620 Pull-request: https://github.com/SerenityOS/serenity/pull/23560 Reviewed-by: https://github.com/ADKaster
1 changed files with 2 additions and 11 deletions
|
@ -6,11 +6,8 @@
|
|||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <RequestServer/Protocol.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace RequestServer {
|
||||
|
||||
|
@ -32,13 +29,7 @@ Protocol::Protocol(ByteString const& name)
|
|||
|
||||
ErrorOr<Protocol::Pipe> Protocol::get_pipe_for_request()
|
||||
{
|
||||
int fd_pair[2] { 0 };
|
||||
if (pipe(fd_pair) != 0) {
|
||||
auto saved_errno = errno;
|
||||
dbgln("Protocol: pipe() failed: {}", strerror(saved_errno));
|
||||
return Error::from_errno(saved_errno);
|
||||
}
|
||||
fcntl(fd_pair[1], F_SETFL, fcntl(fd_pair[1], F_GETFL) | O_NONBLOCK);
|
||||
auto fd_pair = TRY(Core::System::pipe2(O_NONBLOCK));
|
||||
return Pipe { fd_pair[0], fd_pair[1] };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue