Browse Source

Update ssl_port and tcp_port to what peer advertises

Fixes #413
patch-2
Neil Booth 7 years ago
parent
commit
4707e97ab7
  1. 8
      lib/peer.py

8
lib/peer.py

@ -36,14 +36,15 @@ class Peer(object):
# Protocol version # Protocol version
ATTRS = ('host', 'features', ATTRS = ('host', 'features',
# metadata # metadata
'source', 'ip_addr', 'good_ports', 'source', 'ip_addr',
'last_good', 'last_try', 'try_count') '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 # This should be set by the application
DEFAULT_PORTS = {} DEFAULT_PORTS = {}
def __init__(self, host, features, source='unknown', ip_addr=None, 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), '''Create a peer given a host name (or IP address as a string),
a dictionary of features, and a record of the source.''' a dictionary of features, and a record of the source.'''
assert isinstance(host, str) assert isinstance(host, str)
@ -57,7 +58,6 @@ class Peer(object):
# Metadata # Metadata
self.source = source self.source = source
self.ip_addr = ip_addr self.ip_addr = ip_addr
self.good_ports = good_ports.copy()
# last_good represents the last connection that was # last_good represents the last connection that was
# successful *and* successfully verified, at which point # successful *and* successfully verified, at which point
# try_count is set to 0. Failure to connect or failure to # try_count is set to 0. Failure to connect or failure to

Loading…
Cancel
Save