Skip to content

Commit

Permalink
Merge pull request #5 from NielsZeilemaker/small_remove_relay_fix
Browse files Browse the repository at this point in the history
Only remove one part of the relay
  • Loading branch information
Devristo committed Dec 19, 2013
2 parents 670ce55 + bd4dc6c commit d68c4d6
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Tribler/community/anontunnel/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,16 +543,11 @@ def remove_circuit(self, circuit_id, additional_info=''):
def remove_relay(self, relay_key, additional_info=''):
if relay_key in self.relay_from_to:
logger.info(("Breaking relay %s:%d %d " + additional_info) % (relay_key[0].sock_addr[0], relay_key[0].sock_addr[1], relay_key[1]))

relay = self.relay_from_to[relay_key]

# one side of the relay broke, removing both
del self.relay_from_to[(relay.candidate, relay.circuit_id)]
# Only remove one side of the relay, this isn't as pretty but both sides have separate incomming timer, hence
# after removing one side the other will follow.
del self.relay_from_to[relay_key]

return True
else:
return False
return False

def on_create(self, circuit_id, candidate, message):
""" Handle incoming CREATE message, acknowledge the CREATE request with a CREATED reply """
Expand Down

0 comments on commit d68c4d6

Please sign in to comment.