Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anutosh491 committed Mar 20, 2024
1 parent 6dcac5d commit f4603ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/xdealer_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#include "xeus-zmq/xmiddleware.hpp"

#include "xdealer_channel.hpp"

namespace xeus
Expand Down Expand Up @@ -35,8 +37,8 @@ namespace xeus
std::optional<zmq::multipart_t> xdealer_channel::receive_message(long timeout)
{
zmq::multipart_t wire_msg;
m_socket.setsockopt(ZMQ_RCVTIMEO, timeout);
if (wire_msg.recv(m_socket, zmq::recv_flags::none))
m_socket.set(zmq::sockopt::linger, timeout);
if (wire_msg.recv(m_socket))
{
return wire_msg;
} else {
Expand Down
7 changes: 5 additions & 2 deletions src/xiopub_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#include <iostream>

#include "xiopub_client.hpp"
#include "xclient_zmq_impl.hpp"

#include "xeus-zmq/xzmq_serializer.hpp"

Expand Down Expand Up @@ -40,7 +43,7 @@ namespace xeus
std::lock_guard<std::mutex> guard(m_queue_mutex);
if (!m_message_queue.empty())
{
xmessage msg = m_message_queue.back();
xmessage msg = std::move(m_message_queue.back());
m_message_queue.pop();
return msg;
} else {
Expand All @@ -67,7 +70,7 @@ namespace xeus
xmessage msg = p_client_impl->deserialize(wire_msg);
{
std::lock_guard<std::mutex> guard(m_queue_mutex);
m_message_queue.push(msg);
m_message_queue.push(std::move(msg));
}
p_client_impl->notify_shell_listener(std::move(msg));
}
Expand Down
2 changes: 2 additions & 0 deletions src/xiopub_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
#include "zmq.hpp"
#include "nlohmann/json.hpp"

#include "xeus/xmessage.hpp"
#include "xeus/xeus_context.hpp"
#include "xeus/xkernel_configuration.hpp"

#include "xeus-zmq/xthread.hpp"
#include "xeus-zmq/xmiddleware.hpp"

namespace xeus
{
Expand Down

0 comments on commit f4603ee

Please sign in to comment.