Sudden KeyError in addKnownNode()

This commit is contained in:
Dmitri Bogomolov 2021-03-24 14:54:36 +02:00
parent 345403631a
commit f9c1a7bc33
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -159,7 +159,10 @@ def addKnownNode(stream, peer, lastseen=None, is_self=False):
if stream == prev['stream']: if stream == prev['stream']:
if lastseen - prev['lastseen'] > 3600 * 24: if lastseen - prev['lastseen'] > 3600 * 24:
# more than a day ago, this should be port change # more than a day ago, this should be port change
try:
del knownNodes[stream][Peer(peer.host, prev['port'])] del knownNodes[stream][Peer(peer.host, prev['port'])]
except KeyError:
pass
outages[peer.host]['port'] = peer.port outages[peer.host]['port'] = peer.port
else: else:
rating = -0.2 rating = -0.2