mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibCore: Add support for LocalServer to propogate accept() errors
We still log the error (perhaps in the future, we will only want to log the error if there is no handler). But this allows callers to actually handle errors to e.g. unblock waiters.
This commit is contained in:
parent
3994a79718
commit
a4fc7dbf6d
Notes:
sideshowbarker
2024-07-17 10:31:19 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/a4fc7dbf6d Pull-request: https://github.com/SerenityOS/serenity/pull/15981 Reviewed-by: https://github.com/linusg ✅
2 changed files with 4 additions and 1 deletions
|
@ -54,7 +54,9 @@ void LocalServer::setup_notifier()
|
|||
if (on_accept) {
|
||||
auto maybe_client_socket = accept();
|
||||
if (maybe_client_socket.is_error()) {
|
||||
dbgln("LocalServer::on_ready_to_read: Error accepting a connection: {} (FIXME: should propagate!)", maybe_client_socket.error());
|
||||
dbgln("LocalServer::on_ready_to_read: Error accepting a connection: {}", maybe_client_socket.error());
|
||||
if (on_accept_error)
|
||||
on_accept_error(maybe_client_socket.release_error());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
ErrorOr<NonnullOwnPtr<Stream::LocalSocket>> accept();
|
||||
|
||||
Function<void(NonnullOwnPtr<Stream::LocalSocket>)> on_accept;
|
||||
Function<void(Error)> on_accept_error;
|
||||
|
||||
private:
|
||||
explicit LocalServer(Object* parent = nullptr);
|
||||
|
|
Loading…
Reference in a new issue