aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-11-14 14:54:05 +0200
committerRiccardo Spagni <ric@spagni.net>2017-11-14 14:54:05 +0200
commit9317c9c57e72de315f0b53ebc73fce215ed1021f (patch)
treec66af7854ae62f7d1d320963c25ec37f12be6ee5 /tests/unit_tests
parentMerge pull request #2615 (diff)
parentFix an object lifetime bug in net load tests (diff)
downloadmonero-9317c9c57e72de315f0b53ebc73fce215ed1021f.tar.xz
Merge pull request #2617
7dbf76d0 Fix an object lifetime bug in net load tests (moneromooo-monero)
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/epee_levin_protocol_handler_async.cpp8
1 files changed, 5 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 d2aa31555..c749c2531 100644
--- a/tests/unit_tests/epee_levin_protocol_handler_async.cpp
+++ b/tests/unit_tests/epee_levin_protocol_handler_async.cpp
@@ -187,9 +187,11 @@ namespace
typedef std::unique_ptr<test_connection> test_connection_ptr;
- async_protocol_handler_test()
+ async_protocol_handler_test():
+ m_pcommands_handler(new test_levin_commands_handler()),
+ m_commands_handler(*m_pcommands_handler)
{
- m_handler_config.m_pcommands_handler = &m_commands_handler;
+ m_handler_config.set_handler(m_pcommands_handler, [](epee::levin::levin_commands_handler<test_levin_connection_context> *handler) { delete handler; });
m_handler_config.m_invoke_timeout = invoke_timeout;
m_handler_config.m_max_packet_size = max_packet_size;
}
@@ -212,7 +214,7 @@ namespace
protected:
boost::asio::io_service m_io_service;
test_levin_protocol_handler_config m_handler_config;
- test_levin_commands_handler m_commands_handler;
+ test_levin_commands_handler *m_pcommands_handler, &m_commands_handler;
};
class positive_test_connection_to_levin_protocol_handler_calls : public async_protocol_handler_test