Don't connect to myself
This commit is contained in:
parent
8b9d75d726
commit
f9091ea951
1 changed files with 4 additions and 0 deletions
|
@ -290,6 +290,10 @@ class Connection(object):
|
||||||
return handshake
|
return handshake
|
||||||
|
|
||||||
def setHandshake(self, handshake):
|
def setHandshake(self, handshake):
|
||||||
|
if handshake.get("peer_id") == self.server.peer_id:
|
||||||
|
self.close("Same peer id, can't connect to myself")
|
||||||
|
return False
|
||||||
|
|
||||||
self.handshake = handshake
|
self.handshake = handshake
|
||||||
if handshake.get("port_opened", None) is False and "onion" not in handshake and not self.is_private_ip: # Not connectable
|
if handshake.get("port_opened", None) is False and "onion" not in handshake and not self.is_private_ip: # Not connectable
|
||||||
self.port = 0
|
self.port = 0
|
||||||
|
|
Loading…
Reference in a new issue