aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.inl
diff options
context:
space:
mode:
Diffstat (limited to 'src/p2p/net_node.inl')
-rw-r--r--src/p2p/net_node.inl14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 7a2feddc8..13da53b1d 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -2294,7 +2294,17 @@ namespace nodetool
const epee::net_utils::zone zone_type = context.m_remote_address.get_zone();
network_zone& zone = m_network_zones.at(zone_type);
- zone.m_peerlist.get_peerlist_head(rsp.local_peerlist_new, true);
+ std::vector<peerlist_entry> local_peerlist_new;
+ zone.m_peerlist.get_peerlist_head(local_peerlist_new, true, P2P_DEFAULT_PEERS_IN_HANDSHAKE);
+
+ //only include out peers we did not already send
+ rsp.local_peerlist_new.reserve(local_peerlist_new.size());
+ for (auto &pe: local_peerlist_new)
+ {
+ if (!context.sent_addresses.insert(pe.adr).second)
+ continue;
+ rsp.local_peerlist_new.push_back(std::move(pe));
+ }
m_payload_handler.get_payload_sync_data(rsp.payload_data);
/* Tor/I2P nodes receiving connections via forwarding (from tor/i2p daemon)
@@ -2416,6 +2426,8 @@ namespace nodetool
//fill response
zone.m_peerlist.get_peerlist_head(rsp.local_peerlist_new, true);
+ for (const auto &e: rsp.local_peerlist_new)
+ context.sent_addresses.insert(e.adr);
get_local_node_data(rsp.node_data, zone);
m_payload_handler.get_payload_sync_data(rsp.payload_data);
LOG_DEBUG_CC(context, "COMMAND_HANDSHAKE");