IPCCompiler: Make the connection shut down if the peer disconnected

If we know that the peer disconnected while receiving a message in the
generated code, let's shutdown the connection from here instead of
forcing each client to do so.
This commit is contained in:
Lucas CHOLLET 2023-12-27 00:30:29 -05:00 committed by Andreas Kling
parent e56eb11dee
commit 4e9e340d21
Notes: sideshowbarker 2024-07-17 02:05:41 +09:00

View File

@ -514,8 +514,10 @@ void do_message_for_proxy(SourceGenerator message_generator, Endpoint const& end
message_generator.append(";");
} else if (is_try) {
message_generator.append(R"~~~();
if (!result)
return IPC::ErrorCode::PeerDisconnected;)~~~");
if (!result) {
m_connection.shutdown();
return IPC::ErrorCode::PeerDisconnected;
})~~~");
if (inner_return_type != "void") {
message_generator.appendln(R"~~~(
return move(*result);)~~~");