From b7b81a2c56a0511dcc09a7d91a7b18ace44fe44a Mon Sep 17 00:00:00 2001 From: TheKysek Date: Mon, 29 Aug 2016 09:54:23 +0200 Subject: [PATCH] Send more node addresses --- src/connection.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/connection.py b/src/connection.py index 3a215a7..76627ca 100644 --- a/src/connection.py +++ b/src/connection.py @@ -168,6 +168,10 @@ class Connection(threading.Thread): if len(shared.objects) > 0: self.send_queue.put(message.Inv({vector for vector in shared.objects.keys() if shared.objects[vector].expires_time > time.time()})) addr = {structure.NetAddr(c.remote_version.services, c.host, c.port) for c in shared.connections.copy() if not c.server and c.status == 'fully_established'} + if len(shared.node_pool) > 10: + addr.update({structure.NetAddr(1, a[0], a[1]) for a in random.sample(shared.node_pool, 10)}) + if len(shared.unchecked_node_pool) > 10: + addr.update({structure.NetAddr(1, a[0], a[1]) for a in random.sample(shared.unchecked_node_pool, 10)}) if len(addr) != 0: self.send_queue.put(message.Addr(addr)) self.status = 'fully_established'