From 4707e97ab75851f65b98b091f5c2d1e04a749947 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Wed, 14 Mar 2018 08:46:50 +0800 Subject: [PATCH] Update ssl_port and tcp_port to what peer advertises Fixes #413 --- lib/peer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/peer.py b/lib/peer.py index e6cb5f0..ef54215 100644 --- a/lib/peer.py +++ b/lib/peer.py @@ -36,14 +36,15 @@ class Peer(object): # Protocol version ATTRS = ('host', 'features', # metadata - 'source', 'ip_addr', 'good_ports', + 'source', 'ip_addr', 'last_good', 'last_try', 'try_count') - FEATURES = ('pruning', 'server_version', 'protocol_min', 'protocol_max') + FEATURES = ('pruning', 'server_version', 'protocol_min', 'protocol_max', + 'ssl_port', 'tcp_port') # This should be set by the application DEFAULT_PORTS = {} def __init__(self, host, features, source='unknown', ip_addr=None, - good_ports=[], last_good=0, last_try=0, try_count=0): + last_good=0, last_try=0, try_count=0): '''Create a peer given a host name (or IP address as a string), a dictionary of features, and a record of the source.''' assert isinstance(host, str) @@ -57,7 +58,6 @@ class Peer(object): # Metadata self.source = source self.ip_addr = ip_addr - self.good_ports = good_ports.copy() # last_good represents the last connection that was # successful *and* successfully verified, at which point # try_count is set to 0. Failure to connect or failure to