From fdbd946a853e1844df9c5cb48a1491ff99e26a7c Mon Sep 17 00:00:00 2001 From: DerThorsten Date: Thu, 7 Mar 2024 11:09:07 +0100 Subject: [PATCH] changed order --- src/xcomm.cpp | 8 ++++---- src/xkernel_core.cpp | 19 +++++++++---------- src/xkernel_core.hpp | 5 ++--- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/xcomm.cpp b/src/xcomm.cpp index 0fa43637..5a154d63 100644 --- a/src/xcomm.cpp +++ b/src/xcomm.cpp @@ -24,9 +24,9 @@ namespace xeus if (p_manager->p_kernel != nullptr) { p_manager->p_kernel->publish_message( - msg_type, std::move(metadata), std::move(content), - std::move(buffers), channel::SHELL, - std::move(parent_header) + msg_type, std::move(parent_header), + std::move(metadata), std::move(content), + std::move(buffers), channel::SHELL ); } } @@ -77,7 +77,7 @@ namespace xeus if (p_kernel != nullptr) { p_kernel->publish_message( - "comm_close", nl::json::object(), std::move(content), buffer_sequence(), channel::SHELL, request.header() + "comm_close", request.header(), nl::json::object(), std::move(content), buffer_sequence(), channel::SHELL ); } } diff --git a/src/xkernel_core.cpp b/src/xkernel_core.cpp index 5462b012..98ac5a20 100644 --- a/src/xkernel_core.cpp +++ b/src/xkernel_core.cpp @@ -70,8 +70,8 @@ namespace xeus nl::json content, buffer_sequence buffers) { - this->publish_message(msg_type, std::move(metadata), std::move(content), std::move(buffers), - channel::SHELL, request_context.header()); + this->publish_message(msg_type, request_context.header(), std::move(metadata), std::move(content), std::move(buffers), + channel::SHELL); }); p_interpreter->register_stdin_sender([this](xrequest_context request_context, @@ -140,12 +140,11 @@ namespace xeus } void xkernel_core::publish_message(const std::string& msg_type, + nl::json parent_header, nl::json metadata, nl::json content, buffer_sequence buffers, - channel c, - nl::json parent_header - ) + channel c) { xpub_message msg(get_topic(msg_type), make_header(msg_type, m_user_name, m_session_id), @@ -342,14 +341,14 @@ namespace xeus p_server->stop(); nl::json reply; reply["restart"] = restart; - publish_message("shutdown", nl::json::object(), std::move(reply), buffer_sequence(), channel::CONTROL, request.header()); + publish_message("shutdown", request.header(), nl::json::object(), std::move(reply), buffer_sequence(), channel::CONTROL); send_reply(request.identities(), "shutdown_reply", request.header(), nl::json::object(), std::move(reply), c); } void xkernel_core::interrupt_request(xmessage request, channel c) { nl::json reply = nl::json::object(); - publish_message("interrupt", nl::json::object(), std::move(reply), buffer_sequence(), channel::CONTROL, request.header()); + publish_message("interrupt", request.header(), nl::json::object(), std::move(reply), buffer_sequence(), channel::CONTROL); send_reply(request.identities(), "interrupt_reply", request.header(), nl::json::object(), std::move(reply), c); } @@ -367,7 +366,7 @@ namespace xeus { nl::json content; content["execution_state"] = status; - publish_message("status", nl::json::object(), std::move(content), buffer_sequence(), c, parent_header); + publish_message("status", parent_header, nl::json::object(), std::move(content), buffer_sequence(), c); } void xkernel_core::publish_execute_input(nl::json parent_header, @@ -378,11 +377,11 @@ namespace xeus content["code"] = code; content["execution_count"] = execution_count; publish_message("execute_input", + std::move(parent_header), nl::json::object(), std::move(content), buffer_sequence(), - channel::SHELL, - std::move(parent_header)); + channel::SHELL); } void xkernel_core::send_reply(const guid_list& id_list, diff --git a/src/xkernel_core.hpp b/src/xkernel_core.hpp index acbde2df..e7845fe0 100644 --- a/src/xkernel_core.hpp +++ b/src/xkernel_core.hpp @@ -57,12 +57,11 @@ namespace xeus nl::json dispatch_internal(nl::json msg); void publish_message(const std::string& msg_type, + nl::json parent_header, nl::json metadata, nl::json content, buffer_sequence buffers, - channel origin, - nl::json parent_header - ); + channel origin ); void send_stdin(const std::string& msg_type, const guid_list& id_list, nl::json parent_header, nl::json metadata, nl::json content);