Skip to content

Commit

Permalink
POINSON
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Feb 13, 2024
1 parent b8809c3 commit 61d3a92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion nano/node/transport/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@

#include <magic_enum.hpp>

#include <sanitizer/asan_interface.h>

/*
* socket
*/

nano::transport::socket::socket (nano::node & node_a, endpoint_type_t endpoint_type_a, std::size_t max_queue_size_a) :
send_queue{ max_queue_size_a },
strand{ node_a.io_ctx.get_executor () },
tcp_socket{ node_a.io_ctx },
tcp_socket_ptr{ std::make_unique<boost::asio::ip::tcp::socket> (node_a.io_ctx) },
tcp_socket{ *tcp_socket_ptr },
node{ node_a },
endpoint_type_m{ endpoint_type_a },
timeout{ std::numeric_limits<uint64_t>::max () },
Expand All @@ -32,6 +35,8 @@ nano::transport::socket::socket (nano::node & node_a, endpoint_type_t endpoint_t
silent_connection_tolerance_time{ node_a.network_params.network.silent_connection_tolerance_time },
max_queue_size{ max_queue_size_a }
{
__asan_poison_memory_region (poison1.data (), poison1.size ());
__asan_poison_memory_region (poison2.data (), poison2.size ());
}

nano::transport::socket::~socket ()
Expand Down
7 changes: 6 additions & 1 deletion nano/node/transport/socket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ class socket final : public std::enable_shared_from_this<nano::transport::socket

protected:
boost::asio::strand<boost::asio::io_context::executor_type> strand;
boost::asio::ip::tcp::socket tcp_socket;

std::array<uint8_t, 8> poison1;
std::unique_ptr<boost::asio::ip::tcp::socket> tcp_socket_ptr;
boost::asio::ip::tcp::socket & tcp_socket;
std::array<uint8_t, 8> poison2;

nano::node & node;

/** The other end of the connection */
Expand Down

0 comments on commit 61d3a92

Please sign in to comment.