Allow tracker connection to loopback to same client

This commit is contained in:
shortcutme 2018-08-26 02:52:42 +02:00
parent e05c432d14
commit ca3b01f898
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -342,6 +342,9 @@ class Connection(object):
elif self.ip.endswith(".onion"):
handshake["onion"] = self.server.tor_manager.getOnion("global")
if self.is_tracker_connection:
handshake["tracker_connection"] = True
if config.debug_socket:
self.log("My Handshake: %s" % handshake)
@ -351,7 +354,7 @@ class Connection(object):
if config.debug_socket:
self.log("Remote Handshake: %s" % handshake)
if handshake.get("peer_id") == self.server.peer_id:
if handshake.get("peer_id") == self.server.peer_id and not handshake.get("tracker_connection") and not self.is_tracker_connection:
self.close("Same peer id, can't connect to myself")
self.server.peer_blacklist.append((handshake["target_ip"], handshake["fileserver_port"]))
return False