diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-12-09 15:17:52 -0500 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2022-12-25 07:58:58 -0700 |
commit | 1dd14e1324d5506ccc0151380629adb33b6db9c6 (patch) | |
tree | b7c54e8b9be545b9c2c5b30311ab9432f126086d /Ladybird/SQLServer | |
parent | e54932ee73aff875dee2ca06b853cb8f903d369c (diff) | |
download | serenity-1dd14e1324d5506ccc0151380629adb33b6db9c6.zip |
Ladybird: Quit SQLServer when its connected client exits
When Ladybird exits, SQLServer can get stuck spinning at 100% CPU after
the socket connection is closed. This changes the client to quit the
event loop when that disconnect happens to ensure that SQLServer is
properly destroyed.
Diffstat (limited to 'Ladybird/SQLServer')
-rw-r--r-- | Ladybird/SQLServer/main.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Ladybird/SQLServer/main.cpp b/Ladybird/SQLServer/main.cpp index c2c06cfa69..d41cd6fedc 100644 --- a/Ladybird/SQLServer/main.cpp +++ b/Ladybird/SQLServer/main.cpp @@ -36,6 +36,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto client = TRY(SQLServer::ConnectionFromClient::try_create(move(socket), 1)); client->set_fd_passing_socket(TRY(Core::Stream::LocalSocket::adopt_fd(sql_server_fd_passing_socket))); client->set_database_path(move(database_path)); + client->on_disconnect = [&]() { + loop.quit(0); + }; return loop.exec(); } |