mirror of
https://github.com/monero-project/monero.git
synced 2026-07-09 13:49:21 -07:00
Cleanup some of the fragmented levin handling
This commit is contained in:
@@ -506,7 +506,6 @@ TEST_F(positive_test_connection_to_levin_protocol_handler_calls, handler_process
|
||||
}
|
||||
|
||||
std::string compare_buffer(1024 * 4, 'c');
|
||||
compare_buffer.resize(((1024 - sizeof(epee::levin::bucket_head2)) * 5) - sizeof(epee::levin::bucket_head2)); // add padding zeroes
|
||||
|
||||
ASSERT_EQ(4u, m_commands_handler.notify_counter());
|
||||
ASSERT_EQ(0u, m_commands_handler.invoke_counter());
|
||||
@@ -652,3 +651,24 @@ TEST_F(test_levin_protocol_handler__hanle_recv_with_invalid_data, handles_short_
|
||||
|
||||
ASSERT_FALSE(m_conn->m_protocol_handler.handle_recv(m_buf.data(), m_buf.size()));
|
||||
}
|
||||
|
||||
TEST_F(test_levin_protocol_handler__hanle_recv_with_invalid_data, handles_bad_cb)
|
||||
{
|
||||
m_req_head.m_cb = sizeof(epee::levin::bucket_head2);
|
||||
m_req_head.m_flags = LEVIN_PACKET_BEGIN;
|
||||
m_req_head.m_command = 0;
|
||||
|
||||
epee::levin::bucket_head2 inner{};
|
||||
inner.m_cb = 2;
|
||||
m_in_data.resize(sizeof(epee::levin::bucket_head2));
|
||||
prepare_buf();
|
||||
|
||||
ASSERT_TRUE(m_conn->m_protocol_handler.handle_recv(m_buf.data(), m_buf.size()));
|
||||
|
||||
m_req_head.m_cb = 1;
|
||||
m_req_head.m_flags = LEVIN_PACKET_END;
|
||||
m_in_data.resize(1);
|
||||
prepare_buf();
|
||||
|
||||
ASSERT_FALSE(m_conn->m_protocol_handler.handle_recv(m_buf.data(), m_buf.size()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user