diff options
author | Lee Clagett <code@leeclagett.com> | 2019-05-11 11:38:35 -0400 |
---|---|---|
committer | Lee Clagett <code@leeclagett.com> | 2019-07-16 16:30:35 +0000 |
commit | bdfc63ae4ddc52e2dece2a031a91509418206cb0 (patch) | |
tree | 495b13c21a9be88fd2aab8f4d188f115053d12c5 /tests/unit_tests/epee_levin_protocol_handler_async.cpp | |
parent | Merge pull request #5827 (diff) | |
download | monero-bdfc63ae4ddc52e2dece2a031a91509418206cb0.tar.xz |
Add ref-counted buffer byte_slice. Currently used for sending TCP data.
Diffstat (limited to 'tests/unit_tests/epee_levin_protocol_handler_async.cpp')
-rw-r--r-- | tests/unit_tests/epee_levin_protocol_handler_async.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/unit_tests/epee_levin_protocol_handler_async.cpp b/tests/unit_tests/epee_levin_protocol_handler_async.cpp index 697845f60..50fdc7d57 100644 --- a/tests/unit_tests/epee_levin_protocol_handler_async.cpp +++ b/tests/unit_tests/epee_levin_protocol_handler_async.cpp @@ -140,12 +140,12 @@ namespace } // Implement epee::net_utils::i_service_endpoint interface - virtual bool do_send(const void* ptr, size_t cb) + virtual bool do_send(epee::byte_slice message) { //std::cout << "test_connection::do_send()" << std::endl; m_send_counter.inc(); boost::unique_lock<boost::mutex> lock(m_mutex); - m_last_send_data.append(reinterpret_cast<const char*>(ptr), cb); + m_last_send_data.append(reinterpret_cast<const char*>(message.data()), message.size()); return m_send_return; } @@ -367,8 +367,8 @@ TEST_F(positive_test_connection_to_levin_protocol_handler_calls, handler_process // Parse send data std::string send_data = conn->last_send_data(); epee::levin::bucket_head2 resp_head; - resp_head = *reinterpret_cast<const epee::levin::bucket_head2*>(send_data.data()); ASSERT_LT(sizeof(resp_head), send_data.size()); + std::memcpy(std::addressof(resp_head), send_data.data(), sizeof(resp_head)); std::string out_data = send_data.substr(sizeof(resp_head)); // Check sent response |