From 4e9e340d218d2b0c1a2bf8ee0359f9f52ea50051 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Wed, 27 Dec 2023 00:30:29 -0500 Subject: [PATCH] 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. --- Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp b/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp index f7b03c3ba0..36123fdfea 100644 --- a/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp @@ -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);)~~~");