mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 12:32:21 +00:00
ChessEngine: Gracefully handle GUI disconnections
This commit is contained in:
parent
680d4e34d5
commit
55347ed6a5
Notes:
sideshowbarker
2024-07-17 11:33:34 +09:00
Author: https://github.com/tcl3
Commit: 55347ed6a5
Pull-request: https://github.com/SerenityOS/serenity/pull/18140
Issue: https://github.com/SerenityOS/serenity/issues/17427
Reviewed-by: https://github.com/LucasChollet
Reviewed-by: https://github.com/petelliott
2 changed files with 7 additions and 0 deletions
|
@ -68,3 +68,9 @@ void ChessEngine::handle_quit()
|
||||||
if (on_quit)
|
if (on_quit)
|
||||||
on_quit(ESUCCESS);
|
on_quit(ESUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChessEngine::handle_unexpected_eof()
|
||||||
|
{
|
||||||
|
if (on_quit)
|
||||||
|
on_quit(EPIPE);
|
||||||
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ public:
|
||||||
virtual void handle_position(Chess::UCI::PositionCommand const&) override;
|
virtual void handle_position(Chess::UCI::PositionCommand const&) override;
|
||||||
virtual void handle_go(Chess::UCI::GoCommand const&) override;
|
virtual void handle_go(Chess::UCI::GoCommand const&) override;
|
||||||
virtual void handle_quit() override;
|
virtual void handle_quit() override;
|
||||||
|
virtual void handle_unexpected_eof() override;
|
||||||
|
|
||||||
Function<void(int)> on_quit;
|
Function<void(int)> on_quit;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue