Jelajahi Sumber

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.
Lucas CHOLLET 1 tahun lalu
induk
melakukan
4e9e340d21
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp

+ 4 - 2
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);)~~~");