aboutsummaryrefslogtreecommitdiff
path: root/test/test_p2p_stress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_p2p_stress.cpp')
-rw-r--r--test/test_p2p_stress.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/test_p2p_stress.cpp b/test/test_p2p_stress.cpp
index b8ef017..cb6595c 100644
--- a/test/test_p2p_stress.cpp
+++ b/test/test_p2p_stress.cpp
@@ -118,6 +118,9 @@ void install_proto(AppContext &app, const size_t &seg_buff_size) {
tc.hash = msg.hash;
net.send_msg(std::move(msg), conn);
};
+ net.reg_conn_handler([](const ConnPool::conn_t &conn, bool connected) {
+ return true;
+ });
net.reg_peer_handler([&, send_rand](const MyNet::conn_t &conn, bool connected) {
if (connected)
{
@@ -143,7 +146,12 @@ void install_proto(AppContext &app, const size_t &seg_buff_size) {
});
net.reg_handler([&, send_rand](MsgAck &&msg, const MyNet::conn_t &conn) {
auto addr = conn->get_peer_addr();
- assert(!addr.is_null());
+ if (addr.is_null()) return;
+ if (app.tc.find(addr) == app.tc.end())
+ {
+ SALTICIDAE_LOG_WARN("%s\n", std::string(addr).c_str());
+ throw std::runtime_error("violation");
+ }
auto &tc = app.tc[addr];
if (msg.view != tc.view)
{