Only set last_connect if the connection was good
This commit is contained in:
parent
6f32f99a06
commit
5bcbdea16a
@ -189,7 +189,6 @@ class PeerSession(JSONSession):
|
|||||||
def close_if_done(self):
|
def close_if_done(self):
|
||||||
if not self.has_pending_requests():
|
if not self.has_pending_requests():
|
||||||
is_good = not self.failed
|
is_good = not self.failed
|
||||||
self.peer.last_connect = time.time()
|
|
||||||
self.peer_mgr.set_connection_status(self.peer, is_good)
|
self.peer_mgr.set_connection_status(self.peer, is_good)
|
||||||
if is_good:
|
if is_good:
|
||||||
if self.peer.is_tor:
|
if self.peer.is_tor:
|
||||||
@ -512,6 +511,7 @@ class PeerManager(util.LoggedClass):
|
|||||||
'''Called when a connection succeeded or failed.'''
|
'''Called when a connection succeeded or failed.'''
|
||||||
if good:
|
if good:
|
||||||
peer.try_count = 0
|
peer.try_count = 0
|
||||||
|
peer.last_connect = time.time()
|
||||||
peer.source = 'peer'
|
peer.source = 'peer'
|
||||||
# Remove matching IP addresses
|
# Remove matching IP addresses
|
||||||
for match in peer.matches(self.peers):
|
for match in peer.matches(self.peers):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user