diff options
author | Tim Ledbetter <timledbetter@gmail.com> | 2023-04-02 21:04:27 +0100 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-04-20 09:59:18 +0100 |
commit | 55347ed6a59d51edd7a1b1867682cf751fb900be (patch) | |
tree | c289188d37bcbb61c4ad843db2530de73348e168 | |
parent | 680d4e34d5daa0bbe7caa34b18a4ad18cfe55faf (diff) | |
download | serenity-55347ed6a59d51edd7a1b1867682cf751fb900be.zip |
ChessEngine: Gracefully handle GUI disconnections
-rw-r--r-- | Userland/Services/ChessEngine/ChessEngine.cpp | 6 | ||||
-rw-r--r-- | Userland/Services/ChessEngine/ChessEngine.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Services/ChessEngine/ChessEngine.cpp b/Userland/Services/ChessEngine/ChessEngine.cpp index a5395cb906..70a3a5d554 100644 --- a/Userland/Services/ChessEngine/ChessEngine.cpp +++ b/Userland/Services/ChessEngine/ChessEngine.cpp @@ -68,3 +68,9 @@ void ChessEngine::handle_quit() if (on_quit) on_quit(ESUCCESS); } + +void ChessEngine::handle_unexpected_eof() +{ + if (on_quit) + on_quit(EPIPE); +} diff --git a/Userland/Services/ChessEngine/ChessEngine.h b/Userland/Services/ChessEngine/ChessEngine.h index 37ae88603b..1ffd6ea237 100644 --- a/Userland/Services/ChessEngine/ChessEngine.h +++ b/Userland/Services/ChessEngine/ChessEngine.h @@ -19,6 +19,7 @@ public: virtual void handle_position(Chess::UCI::PositionCommand const&) override; virtual void handle_go(Chess::UCI::GoCommand const&) override; virtual void handle_quit() override; + virtual void handle_unexpected_eof() override; Function<void(int)> on_quit; |