Skip to content

Commit

Permalink
changed order
Browse files Browse the repository at this point in the history
  • Loading branch information
DerThorsten committed Mar 7, 2024
1 parent b4c391c commit fdbd946
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/xcomm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}
Expand Down Expand Up @@ -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
);
}
}
Expand Down
19 changes: 9 additions & 10 deletions src/xkernel_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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);
}

Expand All @@ -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,
Expand All @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions src/xkernel_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fdbd946

Please sign in to comment.