Fix UDP channels insert (#1986)
Error in PR https://github.com/nanocurrency/nano-node/pull/1971
This commit is contained in:
parent
77c166b13b
commit
c87dfa3c72
2 changed files with 2 additions and 5 deletions
|
|
@ -586,10 +586,6 @@ bool nano::network::not_a_peer (nano::endpoint const & endpoint_a, bool allow_lo
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else if (!node.network_params.network.is_test_network ())
|
|
||||||
{
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ std::shared_ptr<nano::transport::channel_udp> nano::transport::udp_channels::ins
|
||||||
{
|
{
|
||||||
assert (endpoint_a.address ().is_v6 ());
|
assert (endpoint_a.address ().is_v6 ());
|
||||||
std::shared_ptr<nano::transport::channel_udp> result;
|
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);
|
std::unique_lock<std::mutex> lock (mutex);
|
||||||
auto existing (channels.get<endpoint_tag> ().find (endpoint_a));
|
auto existing (channels.get<endpoint_tag> ().find (endpoint_a));
|
||||||
|
|
@ -415,6 +415,7 @@ public:
|
||||||
{
|
{
|
||||||
node.network.udp_channels.modify (new_channel, [&message_a](std::shared_ptr<nano::transport::channel_udp> channel_a) {
|
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_node_id (message_a.response->first);
|
||||||
|
channel_a->set_last_packet_received (std::chrono::steady_clock::now ());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue