From 0ca079abcd82de9823195467400b59a5be299041 Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Mon, 19 Oct 2026 10:05:47 +0300 Subject: [PATCH] ... --- include/snipplib/network/snplib_netproto.h | 15 ++++++++++++--- include/snipplib/network/snplib_network_asio.h | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/snipplib/network/snplib_netproto.h b/include/snipplib/network/snplib_netproto.h index 1c99a49..59053ec 100644 --- a/include/snipplib/network/snplib_netproto.h +++ b/include/snipplib/network/snplib_netproto.h @@ -380,8 +380,17 @@ struct netproto_binary_blob_t { } else if constexpr (output_char_range_c) { if constexpr (!fixed_size_range_c) { if constexpr (std::constructible_from, - std::ranges::iterator_t>) { + std::ranges::iterator_t> || + std::constructible_from, + std::ranges::sentinel_t>) { res.result = OR(it_start, it_end); // return without blob size field!!! + } else if constexpr (std::constructible_from, + std::ranges::const_iterator_t> || + std::constructible_from, + std::ranges::const_sentinel_t>) { + res.result = OR(it_start, it_end); // return without blob size field!!! + } else if constexpr (std::same_as, OR> || std::same_as, OR>) { + res.result = OR{bytes.data(), bytes.size()}; // return without blob size field!!! } else if constexpr (std::is_default_constructible_v) { std::ranges::copy( std::forward(bytes) | std::views::drop(BLOB_SIZE_FIELD) | std::views::take(blob_sz.value()), @@ -430,8 +439,8 @@ struct netproto_binary_blob_t { // net_repr_proto_result_t, std::ranges::sentinel_t>>> { if constexpr (std::ranges::contiguous_range) { - // return fromNetwork>>(std::forward(bytes)); - return fromNetwork(std::forward(bytes)); + return fromNetwork>>(std::forward(bytes)); + // return fromNetwork(std::forward(bytes)); } else { return fromNetwork, std::ranges::sentinel_t>>( std::forward(bytes)); diff --git a/include/snipplib/network/snplib_network_asio.h b/include/snipplib/network/snplib_network_asio.h index 9fab18e..1f1b3bd 100644 --- a/include/snipplib/network/snplib_network_asio.h +++ b/include/snipplib/network/snplib_network_asio.h @@ -224,7 +224,9 @@ public: break; } + // message must be created from a DEEP-COPY of the input byte sequence!!! + msg = net_connection_t::message_t::fromBytes(msg_bytes.result); // remove only used bytes _recvStreamBuffer->consume(msg_bytes.bytes_used);