From f9091ea951b4ca8e66cde86ca7e70f14e29165a8 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Thu, 8 Feb 2018 18:01:48 +0100 Subject: [PATCH] Don't connect to myself --- src/Connection/Connection.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Connection/Connection.py b/src/Connection/Connection.py index c6e429d9..8fd5300e 100644 --- a/src/Connection/Connection.py +++ b/src/Connection/Connection.py @@ -290,6 +290,10 @@ class Connection(object): return 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 if handshake.get("port_opened", None) is False and "onion" not in handshake and not self.is_private_ip: # Not connectable self.port = 0