Skip to content

Commit

Permalink
Fix UDP channels insert (#1986)
Browse files Browse the repository at this point in the history
Error in PR #1971
  • Loading branch information
SergiySW authored May 15, 2019
1 parent 77c166b commit c87dfa3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 0 additions & 4 deletions nano/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,6 @@ bool nano::network::not_a_peer (nano::endpoint const & endpoint_a, bool allow_lo
{
result = true;
}
else if (!node.network_params.network.is_test_network ())
{
result = true;
}
return result;
}

Expand Down
3 changes: 2 additions & 1 deletion nano/node/transport/udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ std::shared_ptr<nano::transport::channel_udp> nano::transport::udp_channels::ins
{
assert (endpoint_a.address ().is_v6 ());
std::shared_ptr<nano::transport::channel_udp> result;
if (!node.network.not_a_peer (endpoint_a, node.config.allow_local_peers))
if (!node.network.not_a_peer (endpoint_a, node.config.allow_local_peers) && (node.network_params.network.is_test_network () || !max_ip_connections (endpoint_a)))
{
std::unique_lock<std::mutex> lock (mutex);
auto existing (channels.get<endpoint_tag> ().find (endpoint_a));
Expand Down Expand Up @@ -415,6 +415,7 @@ class udp_message_visitor : public nano::message_visitor
{
node.network.udp_channels.modify (new_channel, [&message_a](std::shared_ptr<nano::transport::channel_udp> channel_a) {
channel_a->set_node_id (message_a.response->first);
channel_a->set_last_packet_received (std::chrono::steady_clock::now ());
});
}
}
Expand Down

0 comments on commit c87dfa3

Please sign in to comment.