Handle ip change on onion connection correctly

This commit is contained in:
shortcutme 2018-02-27 02:46:56 +01:00
parent f10233a0a6
commit af57083afd
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 5 additions and 1 deletions

View File

@ -162,8 +162,8 @@ class Connection(object):
self.connected = True
buff_len = 0
req_len = 0
unpacker_bytes = 0
try:
while not self.closed:
buff = self.sock.recv(64 * 1024)
@ -330,7 +330,11 @@ class Connection(object):
self.port = handshake["fileserver_port"] # Set peer fileserver port
if handshake.get("onion") and not self.ip.endswith(".onion"): # Set incoming connection's onion address
if self.server.ips.get(self.ip) == self:
del self.server.ips[self.ip]
self.ip = handshake["onion"] + ".onion"
self.log("Changing ip to %s" % self.ip)
self.server.ips[self.ip] = self
self.updateName()
# Check if we can encrypt the connection