Don't accept onion peers if we have no proxy
This commit is contained in:
parent
f7c95986bf
commit
74c5c3f817
@ -14,6 +14,7 @@ Version 1.6.1 (in progress)
|
|||||||
============================
|
============================
|
||||||
|
|
||||||
* cleaner shutdown process with clear guarantees
|
* cleaner shutdown process with clear guarantees
|
||||||
|
* onion peers are ignored if no tor proxy is available
|
||||||
* add Motion coin (ocruzv)
|
* add Motion coin (ocruzv)
|
||||||
|
|
||||||
Version 1.6 (19 July 2018)
|
Version 1.6 (19 July 2018)
|
||||||
|
|||||||
@ -334,8 +334,9 @@ class PeerManager(object):
|
|||||||
retry = False
|
retry = False
|
||||||
new_peers = []
|
new_peers = []
|
||||||
for peer in peers:
|
for peer in peers:
|
||||||
if not peer.is_public:
|
if not peer.is_public or (peer.is_tor and not self.proxy):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
matches = peer.matches(self.peers)
|
matches = peer.matches(self.peers)
|
||||||
if not matches:
|
if not matches:
|
||||||
new_peers.append(peer)
|
new_peers.append(peer)
|
||||||
@ -499,16 +500,16 @@ class PeerManager(object):
|
|||||||
3) Retrying old peers at regular intervals.
|
3) Retrying old peers at regular intervals.
|
||||||
'''
|
'''
|
||||||
self.import_peers()
|
self.import_peers()
|
||||||
await self.maybe_detect_proxy()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
|
await self.maybe_detect_proxy()
|
||||||
|
await self.retry_peers()
|
||||||
timeout = self.loop.call_later(WAKEUP_SECS,
|
timeout = self.loop.call_later(WAKEUP_SECS,
|
||||||
self.retry_event.set)
|
self.retry_event.set)
|
||||||
await self.retry_event.wait()
|
await self.retry_event.wait()
|
||||||
self.retry_event.clear()
|
self.retry_event.clear()
|
||||||
timeout.cancel()
|
timeout.cancel()
|
||||||
await self.retry_peers()
|
|
||||||
finally:
|
finally:
|
||||||
for session in list(PeerSession.sessions):
|
for session in list(PeerSession.sessions):
|
||||||
session.abort()
|
session.abort()
|
||||||
@ -537,9 +538,6 @@ class PeerManager(object):
|
|||||||
|
|
||||||
peers = [peer for peer in self.peers if should_retry(peer)]
|
peers = [peer for peer in self.peers if should_retry(peer)]
|
||||||
|
|
||||||
if self.env.force_proxy or any(peer.is_tor for peer in peers):
|
|
||||||
await self.maybe_detect_proxy()
|
|
||||||
|
|
||||||
for peer in peers:
|
for peer in peers:
|
||||||
peer.try_count += 1
|
peer.try_count += 1
|
||||||
pairs = peer.connection_port_pairs()
|
pairs = peer.connection_port_pairs()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user