Use peer ip in peer exchange if no active connection

This commit is contained in:
shortcutme 2020-01-28 16:57:20 +01:00
parent 6dae187e22
commit 46210b2f04
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 4 additions and 1 deletions

View File

@ -345,7 +345,10 @@ class Peer(object):
back[hash] += list(map(unpacker_func, peers))
for hash in res.get("my", []):
back[hash].append((self.connection.ip, self.connection.port))
if self.connection:
back[hash].append((self.connection.ip, self.connection.port))
else:
back[hash].append((self.ip, self.port))
return back